python calsses code example

Example 1: calss python

class Person:
  def __init__(self, name, age):
    self.name = name
    self.age = age

p1 = Person("John", 36)

print(p1.name) #>> "John"
print(p1.age) #>> 36

Example 2: what is a class in python

A class is a block of code that holds various functions. Because they
are located inside a class they are named methods but mean the samne
thing. In addition variables that are stored inside a class are named 
attributes. The point of a class is to call the class later allowing you 
to access as many functions or (methods) as you would like with the same
class name. These methods are grouped together under one class name due
to them working in association with eachother in some way.

Example 3: how to use class's in python

class person:
    name = "jake"
    age = 13
x = vars(person)
print(x)