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?
This tutorial will examine several methods and best practices for reading a file line-by-line in the Python programming language. Reading a file line-by-line will be useful for parsing log files, CSV spreadsheet files, or even reading files you have generated from an application yourself. Line… Read More »Read a File Line by Line in Python [3 Methods]
This article shows you how to use the string.replace() method in Python to replace elements in a string of characters and includes useful examples. Python String replace Syntax The replace() function can be called on existing string variables like so: string.replace(find, new, count) Where: string is the existing string… Read More »Python String replace Method [With Examples]