class and objects

Sai_kiran_rachakonda · June 16, 2022
class Person:
    def __init__ (self, name, age, sal, city):
        self.name = name
        self.age = age
        self.sal = sal
        self.city = city
        
p = Person('saikiran', 23,250000, 'california')
print(p.name)
print(p.age)
print(p.sal)
print(p.city)
print(p)
Output

Comments

Please sign up or log in to contribute to the discussion.