Classes and Objects
Practice / Tutorial
Practice / Tutorial
w3schools
w3schools
Most Important Concepts
Most Important Concepts
A class is code and is like a blueprint.
An object is an instance of a class.
An object is located in memory and is like a house built from a blueprint.
Sample Program
Sample Program
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def myfunc(self):
print("Hello my name is " + self.name)
p1 = Person("John", 36)
p1.myfunc()