0
Object in pyhton
Hi how can i make n object for a class in python for example i don't know how many objects user wants to enter
4 Respostas
+ 3
+ 3
userobjects = []
while True:
t= input ()
if t == "exit" : break
userobjects.append(object(t) )
0
thank you but again i dont get it
0
That is depend on user. You can create as per your requirement.
Let say below is class Temp with no data.
class Temp:
pass
If user want 2 instance,
t1 = Temp()
t2 = Temp()
print (t1, t2)