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

7th Jun 2020, 3:47 AM
nima rasi
4 Answers
7th Jun 2020, 4:17 AM
Ayush Dwivedi
Ayush Dwivedi - avatar
+ 3
userobjects = [] while True: t= input () if t == "exit" : break userobjects.append(object(t) )
7th Jun 2020, 6:28 AM
Oma Falk
Oma Falk - avatar
0
thank you but again i dont get it
7th Jun 2020, 4:25 AM
nima rasi
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)
7th Jun 2020, 4:33 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar