Aug-18-2021, 09:54 PM
(This post was last modified: Aug-18-2021, 10:42 PM by Yoriz.
Edit Reason: Added code tags
)
i created empty list, enter a name in list by inputting user. I have placed 2 condition here.
This will ask from user to add more name after add first name. If user press y it will go into the loop and ask the same question upto 9 times. This loop is exit at 9 iteration.
If user press n at anytime this should be out of loop and print list values but this option is not working properly. Condition one is working fine but condition 2 isn't working properly.
This will ask from user to add more name after add first name. If user press y it will go into the loop and ask the same question upto 9 times. This loop is exit at 9 iteration.
If user press n at anytime this should be out of loop and print list values but this option is not working properly. Condition one is working fine but condition 2 isn't working properly.
a=[] #Empty list define i=1 #Loop iteration set to 1 print ('You can add maximum ten names') b=print(input("Enter your name :")) while True or i!=10: c=input('Do you wish write more name y/n?:') if c=='y' or i!=10: b=input("Enter your name :") a.append(b) i=i+1 elif c=='n' or i!=10: exit() print(a) if i==10: print (a) print('Thanks')