1.How do restrict if user type same stuname..it will show an (already)2.if user enter same stuname,same age,but city is differen | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

1.How do restrict if user type same stuname..it will show an (already)2.if user enter same stuname,same age,but city is differen

1.How do restrict if user type same stuname..it will show an (already)2.how do code iff user enter same stuname,same age,but city is different.. https://code.sololearn.com/czD1Keq9J3oV/?ref=app

27th Aug 2020, 6:27 PM
Rohit Murali
12 Answers
+ 2
Rohit Murali did it work?
27th Aug 2020, 6:53 PM
Namit Jain
Namit Jain - avatar
+ 1
Tq Steven..But I couldn't understand.. just I'm a beginner level..could u plz implement with my code
27th Aug 2020, 6:35 PM
Rohit Murali
+ 1
Try this: (put this in the mainmenu after taking input) if any([i[0]==newname and i[1]==newage and i[2]==newcity for i in ls]): print("repeated!") else: obj.add(newname,newage,newcity) Do you wanna add if the city name is different?
27th Aug 2020, 6:41 PM
Namit Jain
Namit Jain - avatar
+ 1
Yes..if user enter same stuname,same age,and same city(print already) but user type same stuname,same age,and if city is different..it will allows..
27th Aug 2020, 6:47 PM
Rohit Murali
+ 1
Tq namit for ur time and help..
27th Aug 2020, 6:48 PM
Rohit Murali
+ 1
You didn't give heed to my solution 😐 https://code.sololearn.com/cVYO21m37XG9/?ref=app
27th Aug 2020, 7:33 PM
Namit Jain
Namit Jain - avatar
+ 1
This is exactly want..Tq soo soo much namit....all is well..I will practice and let u know Tomorrow..if I have any dbt..I can ask..
27th Aug 2020, 7:39 PM
Rohit Murali
0
plz Anyone give solution
27th Aug 2020, 6:27 PM
Rohit Murali
0
I believe you will benefit from matching inputs to a dictionary https://code.sololearn.com/cmz6Yj5ZlBvA/#py
27th Aug 2020, 6:29 PM
Steven M
Steven M - avatar
0
I want to..if user type same stuname,same age..but city wil different..if all the same..it will show (already )
27th Aug 2020, 6:36 PM
Rohit Murali
0
Hi Steve tq very much for help..but I want to show error..when user type same stuname.
27th Aug 2020, 7:23 PM
Rohit Murali
0
Ur implementation of code not show error..it will show same data's 2times ..I don't want..
27th Aug 2020, 7:24 PM
Rohit Murali