How to Generate a Random Number in Python

In Python, just like in almost any other OOP language, chances are that you’ll find yourself needing to generate a random number at some point. Whether you’re just completing an exercise in algorithms to better familiarize yourself with the language, or if you’re trying to write more complex code, you can’t call yourself a Python coder […]

Read More

How to Test for Positive Numbers in Python

The following Python snippet demonstrates how to test if an inputted number is positive, negative, or zero. The code is simple, straightforward, and works with any number or integer. The code uses an if…elif…else statement to determine if a number is greater than 0 (in which case it has to be positive), elif a number […]

Read More

Using Python’s Pass Statement

In Python, the pass statement, much like a comment, is considered a null statement, meaning that it doesn’t result in any Python operations. The only difference between a comment and a pass statement is that while a comment is completely ignored by the interpreter, the pass statement is not (but, like a comment statement, nothing […]

Read More

How to Test for Prime Numbers in Python

As with any OOP language, you can use Python to conduct calculations and gather information about numbers. One cool thing you can do with Python is test if a number is prime or not. A prime number, as you may remember from math class way back when, is any whole number (it must be greater […]

Read More

Python Basics: What Are Modules?

In Python, modules are Python files containing Python functions to be implemented in your code. You’ll know a file is a module because of its .py extension. We can import modules easily using the import command, like this: import mymodule The example above will work when theres a file called mymodule.py from which functions can […]

Read More

Python’s help() Function

In Python, help() is a super useful built-in function that can be used to return the Python documentation of a particular object, method, attributes, etc. This is such a helpful tool for Python beginners to know that many of them are probably unaware of. All you need to do is pass the object or whatever […]

Read More

Using the Python Package Index

The Python Package Index (PyPI) is a repository of software created for the Python language. If you’re looking for a package or a module, this is the place to find one. Any of the packages can be easily installed using PIP from the command line. At PyPI, you can download packages OR you can post them, if […]

Read More

Quick Tip: Where to Report Your Python Bugs

Python’s Bug Tracker is the official page to report any and all Python bugs you may encounter. While it is a good place to go if you think you’ve found a legitimate bug, it’s also a great place to meet other Python developers who may be able to help you (or validate your findings). Using the […]

Read More

Debug Your Python Code: PyChecker

PyChecker is a valuable tool to use to check and debug your Python code. This tool is especially useful to have if you’re just beginning to learn the language — trying, failing, and learning from your mistakes is often the best way to learn to code! Luckily for beginner coders, PyChecker is very easy to […]

Read More

Interactive Resources: Learn and Practice Python for Free

Python is a great coding language to have under your belt. Not only is it a well sought after and lucrative skill, but it’s also one that will help you stand out when searching for jobs. If you’re looking to start learning, check out any of these web apps and tools that will help you […]

Read More