If you have not read the first blog on the why, how, and hope of this series, check out the first here Python 2 vs Python 3 🐍: Which one?!?! I think the biggest reason why I have chosen Python 3 over Python 2 is that starting this year, there will be no maintaining of Python 2 and almost no more bug fixes (see more here on Python’s official ). Thus, I’ve decided to go ahead and code in Python 3 for the remainder of this series. Now, with that comes an interesting question: what’s changed between versions? What I’ve seen on the internet and many of blog posts, it’s a few things that come to mind: documentation Hello World print( ) Hello World # Python 2 verison of print >>> print "Hello World" # Python 3 version of print - print is now a function >>> "Hello World" print statements in Python3 a = range( , ) % a [ , , , ,... ] b = xrange( , ) print(b) xrange( , ) i b: % i [ , , , ,... ] c = range( , ) print(c) range( , ) new_c = list(c) print(new_c) [ , , , ,... ] #Python 2 - range([start - optional], stop, [step - optional]) vs. xrange([start - optional], stop, [step - optional]) #range gives you a python list of values that you can iterate through immediately >>> 1 100 >>> print "%s" 0 1 2 3 .99 #xrange gives you back an object that evaluates lazily 👉🏾 (as you need it/on-demand) - good for memory >>> 1 100 >>> 1 100 >>> for in >>> print "%d" 0 1 2 3 .99 #Python 3 - there is no more xrange! Just 1 range to rule them all (range in Python 3 includes xrange) >>> 1 100 >>> 1 100 # if you want to make a list out of the range object >>> >>> 0 1 2 3 .99 range vs xrange in Python -> see more explanation at this stack Overflow post 👉🏾 https://bit.ly/2SPX4c5 num1 = / num2 = / print(num2) #Python 2 - watch out for values that evaluate to float data types! >>> 1 2 >>> print "num" 0 #Python 3 - you'll get a float value >>> 1 2 >>> 0.5 float handling in Python3 While this is not at all an exhaustive , I hope this gives an idea of somethings that have changed from Python 2 to Python 3. Ultimately, if you are working on a legacy system of some sort, you might have to switch to Python 2 so the best case scenario is to be comfortable with both versions 😃. list What’s a Class? Seeing as the blog posts will focus on the understanding and implementation of data structures and algorithms, I think it’s important to explain a fundamental part of any object-oriented programming language, and that’s . Rather than give you a definition first, it may be easier to think about a picture. Let’s think about your standard calculator. classes Photo by on StellrWeb Unsplash A calculator has many different that a person has access to. A person can come to the calculator with their given numbers and add, subtract, multiply, divide and (depending on if it’s a fancy calculator) also plot graphs, utilize charts, and much more. A class in python is no different than a calculator. functions You can think of a class as (the calculator’s job is not to tell you the weather 👉🏾 it’s to crunch numbers) (your finger would be the object, in this case, accessing the functionality of the calculator, providing the input in numbers and operations and the calculator gives you the desired output). an interface with defined functionality and attributes to be accessed through an object This can take you down a rabbit hole of examples when you think it through (a car can be considered a class, the remote you use for you tv can be considered a class, the possibilities and internet are endless with examples 😂). We’ll choose to stay above ground and see what this simple example looks like in code 😃 Building a Calculator From Scratch self.num1 = num1 self.num2 = num2 : class Calculator : def __init__ (self, num1, num2) Consider this like the laying of groundwork for the Class The def __init__ is considered to initialize the class¹. Most, if not all classes have this at the top of the class file. You might be wondering about the in the argument list. This took me a while to figure out when first learning object-oriented programming but in a nutshell, the self is “used to being created at the moment” of initialization¹. Num1 and Num2 are both considered as attributes and more so represent how you can extend your class (you don’t have to use the same two numbers every single time you use your calculator). self refer to the object (n1 + n2) (n1 - n2) (n1 * n2) (n1/n2) : def add (self, n1, n2) return : def subtract (self, n1, n2) return : def multiply (self, n1, n2) return #remember in Python3 from above, you'll get out floats if you pass two integers : def divide (self, n1, n2) return Rest of the functionality of the Calculator class The add, subtract, multiply, and divide functions above would be considered the actual “buttons” that a user of the calculator would physically press for the desired usage. These functions work in the exact same way! Once you create your object, you can then access the class functions via the object as you can see below 👇🏾 self.num1 = num1 self.num2 = num2 (self.num1 + self.num2) (self.num1 - self.num2) (self.num1 * self.num2) (self.num1/self.num2) : class Calculator : def __init__ (self, num1, num2) : def add (self) return : def subtract (self) return : def multiply (self) return : def divide (self) return Final Calculator.py file you would save cal_object1 = Calculator( , ) cal_object1.add() cal_object1.multiply() cal_object1.subtract() cal_object1.divide() cal_object1.num1 cal_object1.num2 cal_object2 = Calculator( , ) cal_object2.add() # assuming you have saved the above code to a .py file in the same directory of launching python interpreter or ipython >>> 4 5 #cal_object1 is now the object that you will use to access the functions/methods in the Calculator class >>> 9 >>> 20 >>> -1 >>> 0.8 >>> 4 >>> 5 # The flexible part about creating a class is assigning different attributes (or in our case numbers) # all you have to do is create a new object! >>> 10 20 >>> 30 Object creation using Calculator.py You Did It! GIF from https://giphy.com/ If this example makes sense and you are solid on the information, you did it! Pat yourself on the back 😃. Being comfortable with classes moving through the series is very important as the data structures and algorithms that we will be invoking are not native to Python (or really any other language), therefore they will need to be built before implemented. Seeing as the only way to get better is through practice, I will be posting some programming problems sometime next week via online flashcards that I will share publicly so you can practice your programming anywhere. Until next time! 👋🏾 If your interest was peaked and/or have been in encouraged/helped by this blog post, follow me on Twitter ( )! @jeff_ridgeway4 References: [1] Shovic, John C, and Alan Simpson. “Doing Python with Class.” , John Wiley & Sons, Inc., 2019, pp. 213–220. Python All-In-One For Dummies Photo by on Hitesh Choudhary Unsplash Previously published at https://medium.com/@walkingtruth146/re-learning-data-structures-and-algorithms-series-python-3-classes-95095e1c70c7