How to create class and object in Python?

All QuestionsCategory: PythonHow to create class and object in Python?
Chetan Shidling asked 4 years ago

I need short information.

2 Answers
Chetan Shidling answered 4 years ago

Ok, I will share one example where I will create two objects and one class.
 
class laptop:
      def config(self):
             print(“i5, 16gb, 1TB”)
 
com1 = laptop()
com2 = laptop()
 
laptop.config(com1)
laptop.config(com2)
 
com1 and com2 are the two objects. laptop is a class.

Chetan Shidling answered 4 years ago

The output of above code will be;
 
i5, 16gb, 1TB
i5, 16gb, 1TB