+ 1
Python how do add stuname,age,city in add() function python
14 Answers
+ 1
I need this code run continuously..when user enter 3..then only exit the program.. otherwise it run continuously
0
Anyone help me
0
the add method can be like this
def add(self):
ls=[]
ls += self.stuname,self.age,self.city
print(ls)
0
Tq so much ruba..I can try this..and let u know..
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)
0
Mm ok ruba.. really u doing good work..helping mind..🤗👍
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
0
Aha I some how understand what did you mean
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
0
And tell me if that what you need
0
I'm really lucky..I was troubling in this code past 1weeks.now ok.but 1 kind request
0
print("""select 1 to 3 to selection
1.stulist
2.add
3.exit""")
selection=input("make select \n")
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
0
Tqqq soo much ruba..I'm studying python 1month..this is my 1st program..