class object oriented programming python code example
Example 1: class python
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
p1 = Person("John", 36)
p1.age = 40
print(p1.age)
---------------------------------------------------------------
40
Example 2: real python oop
>>> class Dog:
... pass
...
>>> a = Dog()
>>> type(a)
<class '__main__.Dog'>