+ 1

Python how do add stuname,age,city in add() function python

https://code.sololearn.com/cXn71cRah69y/?ref=app

26th Aug 2020, 11:17 AM
Rohit Murali
14 Answers
+ 1
I need this code run continuously..when user enter 3..then only exit the program.. otherwise it run continuously
26th Aug 2020, 6:37 PM
Rohit Murali
0
Anyone help me
26th Aug 2020, 11:18 AM
Rohit Murali
0
the add method can be like this def add(self): ls=[] ls += self.stuname,self.age,self.city print(ls)
26th Aug 2020, 12:23 PM
Ruba Kh
Ruba Kh - avatar
0
Tq so much ruba..I can try this..and let u know..
26th Aug 2020, 12:28 PM
Rohit Murali
0
You can also do it using extend as extend can append multiple value while append is only for appending one value at a time def add(self): ls=[] ls.extend([self.stuname,self.age,self.city]) print(ls)
26th Aug 2020, 12:31 PM
Ruba Kh
Ruba Kh - avatar
0
Mm ok ruba.. really u doing good work..helping mind..🤗👍
26th Aug 2020, 12:35 PM
Rohit Murali
0
I want to run a program...if user press 2..it's add new stuname,age,city..also run continuously when user press 3exit
26th Aug 2020, 4:37 PM
Rohit Murali
0
Aha I some how understand what did you mean
26th Aug 2020, 6:29 PM
Ruba Kh
Ruba Kh - avatar
0
2 Mohammed 13 Abudhabi Add Amer 43 Ajman Add Rami 15 Sharja 3 Try this input with this code https://code.sololearn.com/cnFKH6x5vvMt/?ref=app
26th Aug 2020, 6:31 PM
Ruba Kh
Ruba Kh - avatar
0
And tell me if that what you need
26th Aug 2020, 6:31 PM
Ruba Kh
Ruba Kh - avatar
0
I'm really lucky..I was troubling in this code past 1weeks.now ok.but 1 kind request
26th Aug 2020, 6:35 PM
Rohit Murali
0
print("""select 1 to 3 to selection 1.stulist 2.add 3.exit""") selection=input("make select \n")
26th Aug 2020, 6:36 PM
Rohit Murali
0
Okey try it now with this input 1 2 Mohammed 12 Ajman 2 Rami 23 Sharja 2 Mustafa 12 Dubai 1 3 https://code.sololearn.com/cnFKH6x5vvMt/?ref=app
26th Aug 2020, 6:50 PM
Ruba Kh
Ruba Kh - avatar
0
Tqqq soo much ruba..I'm studying python 1month..this is my 1st program..
26th Aug 2020, 7:21 PM
Rohit Murali