+ 1

How to make a user enter sentences in a str variable untill he inputs 0 (zero)?

27th Jun 2016, 4:20 AM
Aakash Vyas
Aakash Vyas - avatar
2 Réponses
+ 4
sentence = input('Please enter your sentence: ') while sentence ! = '0': sentence = input('Please enter your sentence: ')
27th Jun 2016, 12:46 PM
Rosa Mø
Rosa Mø - avatar
0
while true: s = input('enter ur sentence:\n ') if s == '0': break print (s) this will open an infinite loop,print everything u enter untill u enter 0,when the condition is met it will break and exit the loop
12th Jul 2016, 12:06 AM
vicken bedikian
vicken bedikian - avatar