Python

Python Unit Testing using pytest

Unit testing is the act of testing a small unit of your code. Generally this means you are tesitng a function or a class in isolation. If you are doing this unit testing manually, you simply run your function, then check and make sure it gave you the expected output. This is what you have been manually doing ever since you first started writing software.As your software projects grow larger, this manual testing becomes less feasible. And you might start missing things that you would have caught during Read more […]

Read More

Python data types explained

In python, almost everything is an object. This includes variables like String and Integers and containers like lists and dictionaries. Given that everything is an object, what are data types? Data types are simply how you classify your objects. If you have a an object with the type of String, then that object will have all of the string properties and functions. If you have an object with a type of integer, then that object will have all the applicable properties and functions associated with integers. Given Read more […]


What is JSON? (JavaScript Object Notation)

Javascript Object Notation, or JSON for short, is a data structure that uses only human-readable text to transfer or store information. It is very popular, especially in the context of web technologies, for transferring data between applications.JSON allows you to import and export data in a structured manner without doing a lot of work to parse it. Frequently when you interact with a REST API, you will pass JSON structures back and forth. An example of when JSON is used for storing data can be seen Read more […]


Python Objects and Classes

Python is an Objected Oriented programming language. This means that Python has a data type called objects. Today we will discuss what objects are; how are objects relate to classes; and when you should use objects and classes. What are Objects? Objects are containers that hold a collection of attributes and functions. As an example, you might create an application that tracks dogs. For reach dog you are tracking, you might create an object. Then for each dog object, there is a collection of Read more […]


Working with Python Collections

A collection in Python is an object that contains other objects. You can also think of it as a container or a bucket. There are many different kinds of collections contained within the containers module in Python. Today, we will discuss the different kinds of Python Collections/Containers. How to use the different kinds of Containers. and when you should use which one.Data TypesThe four main container types are: List Tuple Dictionary Set All of these containers are similar to an array. But, Read more […]


two guys arm wrestling at a bar in black and white

Mutable vs Immutable objects in Python

There are two types of objects in Python, Mutable and immutable objects. Mutable objects are more flexible in that these objects can be changed in place. Immutable objects are more static and cannot be changed without allocating a new object of the new type or with the new value. In some languages, almost all variables are immutable. In other languages most objects are mutable, and you can be fairly liberal with changing the objects whenever you want. Today we will discuss mutable vs immutable objects.  Read more […]


Python Numbers

Today we will discuss the different kinds of number variables in Python. How to interact with them, and what they are used for. There are four kinds of numbers in the python language: Int Long Float Complex Integers Integers are the basic kinds of numbers in any programming language. Integers are whole numbers, which means they do not have a decimal point. They can be either positive or negative. In Python 2 there is a maximum int size of 9223372036854775807. You can see this Read more […]


Working with DateTime objects in Python

When you read a date or time from a text file, user input, or a database, you are likely to get the date information as a string. It is helpful to convert the string to a datetime object since it will allow you to do more advanced functions. In todays article I will discuss and show examples of datetime objects in python. Specifically, I will show how to convert a string to a datetime, how to compare and reformat datetime variables, how to work with timezones, and how to extract specific bits of Read more […]


Using TinyDB with Python

When writing your python code, you will undoubtedly find yourself in the situation where you need to store some structured data. You could just write the data to a file, but that data might take a bit of work to parse later on. Setting up a MySQL server takes a bit of work, and might be overkill for what you are trying to do. Today we will discuss how to use TinyDB in your python application to store structured data in JSON format.  And then easily retrieve that data without any fancy coding gymnastics What Read more […]


Python Math Operators

Understanding the Python Math Operators is very important. You use these operators throughout the Python language whether it be concatenating strings, doing basic algebra, complex calculus, or delving into data science. In this article, we will cover the basics of doing math with python including how to do multiplication, division, addition subtraction, exponents, and orders of operation. What is an Operator? A math operator is a symbol that defines a specific kind of logic. For example, if Read more […]