what are class properties in python code example

Example 1: class attributes in python

class MyClass:
  # Class attributes are defined outside of constructor
  class_attr = 0
  
  def __init__(self, inst):
    # Instance attributes are defined in the constructor
    self.instance_attr = inst
    
obj = MyClass(1)
print(obj.class_attr) # outputs 0
print(obj.instance_attr) # outputs 1
print(MyClass.class_attr) # outputs 0
print(MyClass.instance_attr) # raises AttributeError

Example 2: python class

class Person:#set name of class to call it 
  def __init__(self, name, age):#func set ver
    self.name = name#set name
    self.age = age#set age
   

    def myfunc(self):#func inside of class 
      print("Hello my name is " + self.name)# code that the func dose

p1 = Person("barry", 50)# setting a ver fo rthe class 
p1.myfunc() #call the func and whitch ver you want it to be with