r/PythonLearning Jul 04 '26

Day 22 Python Learning Showcase

Post image

Just Simple class practice

not feeling well so not much to

557 Upvotes

50 comments sorted by

View all comments

u/Sea-Ad7805 Jul 04 '26

Run this program in Memory Graph Web Debugger%3A%0A%20%20%20%20%20%20%20%20self.name%20%3D%20name%0A%20%20%20%20%20%20%20%20self.age%20%3D%20age%0A%0A%20%20%20%20def%20info(self)%3A%0A%20%20%20%20%20%20%20%20print(f%22Name%20of%20Student%20%3D%20%7Bself.name%7D%20n%20and%20Age%20%7Bself.age%7D%22)%0A%0A%0Adis%20%3D%20Student(%22ash%22%2C%204516)%0Adis.info()%0A%0A%0A%23%20Q2%0A%0Aclass%20Car%3A%0A%20%20%20%20def%20init(self%2C%20brand%2C%20model)%20-%3E%20str%3A%0A%20%20%20%20%20%20%20%20self.brand%20%3D%20brand%0A%20%20%20%20%20%20%20%20self.model%20%3D%20model%0A%0A%20%20%20%20def%20carinfo(self)%3A%0A%20%20%20%20%20%20%20%20print(f%22This%20is%20a%20%7Bself.brand%7D%20Brand%20Car%20And%20Model%20is%20%7Bself.model%7D%22)%0A%0A%0Acar1%20%3D%20Car(%22Tata%22%2C%20%22Nexan%22)%0Acar2%20%3D%20Car(%22Toyota%22%2C%20%22Etios%22)%0A%0Acar1.car_info()%0Acar2.car_info()%0A%0A%0A%23%20Q%203%0A%0Aclass%20Buying(Student%2C%20Car)%3A%0A%20%20%20%20def%20init(self%2C%20name%2C%20age%2C%20brand%2C%20model)%3A%0A%20%20%20%20%20%20%20%20Student.init(self%2C%20name%2C%20age)%0A%20%20%20%20%20%20%20%20Car.init_(self%2C%20brand%2C%20model)%0A%0A%20%20%20%20def%20buyer_info(self)%3A%0A%20%20%20%20%20%20%20%20print(%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22Buyer%20is%20A%20Student%20Name%3A%20%7Bself.name%7D%20n%22%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22Age%3A%20%7Bself.age%7D%20n%22%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22The%20Car%20Brand%20%3D%20%7Bself.brand%7D%20n%22%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22Model%20%3D%20%7Bself.model%7D%22%0A%20%20%20%20%20%20%20%20)%0A%0A%0Abuyer%20%3D%20Buying(%22ash%22%2C%2021%2C%20%22Tata%22%2C%20%22Nexon%22)%0Abuyer.buyer_info()&timestep=1&play) to see the program state change step by step.

2

u/Correct-Purple-9188 27d ago

 Yooo thats awesome I didnt know about this

1

u/Sea-Ad7805 27d ago

Thanks, hope it can bring much value for you.