Welcome to another Python 3 basics tutorial. This tutorial is going to cover the very basics of classes in Python. For the most part, I just want you to just understand how to read and understand a class' workings. You can think of classes as groupings of functions, usually. Classes quickly work their way into "intermediate" programming, so hopefully I can just help you understand how they work and how to follow code that uses them.
Classes are the backbone to Object Oriented Programming, or OOP. As you get comfortable with Python, classes can become an absolutely integral part of our programs.
Here is the sample code to supplement the video tutorial:
class calculator: def addition(x,y): added = x + y print(added) def subtraction(x,y): sub = x - y print(sub) def multiplication(x,y): mult = x * y print(mult) def division(x,y): div = x / y print(div)
Here are some examples using the above code in the interpreter:
Hopefully that helps to break the ice when it comes to Python 3 classes!
Classes are used for Object Oriented Programming, or OOP. If you'd like to learn more about the intricacies of classes and OOP, then check out my object oriented programming (OOP) crash course tutorial.