0
I want to exit programm after enter one name and one contactnumber but exit is not working will anyone solve this prblm??
3 Antworten
0
Kajal Kumari
Sololearn doens't support input one by one. You have to take input together with separate lines. So it is not possible like that.
0
I have tried at pc also but not working
0
Kajal Kumari
Doens't matter it is PC or Mobile. This code will not work in Sololearn playground.
Btw you have you have taken same variable for both input so exit will work when you enter exit in 2nd input.
Also if you have used "break" on condition (choice == 'exit') then no need to check while condition (choice != 'exit'), you can simply do:
while True:
#input1
#input2
#input3
if input3 == 'exit':
break
Try this:
while True:
choice1 = input("enter name of person \n")
print("name is:" + choice1)
choice2 = input("enter contactnumber of person \n")
print("contactnumber:" + choice2)
choice3 = input()
if choice3 == 'exit':
break
Take input with separate lines like:
AJ
9876543210
exit