This article will show you how to use the Python reduce() function to aggregate data from values in an iterable (iterables are things like lists, dictionaries, sets, or tuples – collections containing items that can be looped over) and reduce them to a single accumulated value. The code and examples… Read More »Using the Python ‘reduce()’ Function to Aggregate Data, With Examples
This article will explain how to use recursion in Python functions, with some example code to illustrate the concept. A recursive function is a function which calls itself one or more times until a condition is met. If a function that uses recursion calls itself too many… Read More »Using Recursion/Recursive Functions in Python, with Examples
This was only meant to be a two-parter, but I couldn’t leave well enough alone. Raspberry Pi & Python Powered Tank Part III is an update with better Python code and an improved design. I’ve gone back to fix the biggest issues that were left… Read More »Raspberry Pi & Python Powered Tank Part III: More Tank
This tutorial covers converting Bytes to a string variable (and a string to Bytes) in Python versions 2 and 3. What is the difference between a string and a byte string? A string is a series of characters. When stored on disk, the characters are converted to a series of bytes. What… Read More »Converting Bytes To String In Python [Guide]
This article explains how to check the type of a variable in the Python programming language. What are Types? The type of a variable determines what it can or can’t do. It determines what value the variable may take and what can be done with that value. Using the type() Function… Read More »Checking Type in Python [Guide]
As you build more complex Python apps, you will probably want to start splitting your code into separate files. What Is the __main__ Function? Importing and executing code from another file is common in even small scripts and apps built with Python. As your library… Read More »Python Main Function & Method: What Is It and How Is It Used?
This article covers getting user input on the command line using Python 2 or 3 and includes some useful examples. Get User Input in Python 3 Python 3 uses the input() function to collect user input: myText = input(“Enter some text:”) print(“You entered the text: ” + myText)… Read More »How to Get User Input in Python [With Examples]
Graphs are awesome. If you disagree, you probably shouldn’t read on. The best (and easiest!) way to create graphs and scatter plots in Python is using the package Matplotlib. This tutorial explains exactly how to do so. https://pypi.org/project/matplotlib/ What is matplotlib? I’ll let them introduce themselves in their… Read More »Python Scatter Plots with Matplotlib [Tutorial]
The Python isinstance() function determines the type or class of a variable. Read on to find out exactly how isinstance works, with an example below. What are Types? The type of a variable determines what it can or can’t do. It determines what value the variable may take and what can be done with that value. isinstance… Read More »Python isinstance Function, With Example [Guide]
A Tuple is a type of variable in Python – a data structure containing multiple parts. It’s a collection (or array) of data – but a specific kind of collection. It’s Ordered (Indexed) Elements in a tuple are stored in order – stored with an index or position – their position in the… Read More »What is a Tuple in the Python Programming Language?