Fill in the blanks to break the infinite loop when the user enter 0. While true: x=input(). __x=='__'. ______ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

Fill in the blanks to break the infinite loop when the user enter 0. While true: x=input(). __x=='__'. ______

Important question

25th Apr 2021, 4:00 PM
...Mansi...
...Mansi... - avatar
8 Answers
+ 6
Hello there! A hint-tip for resolving your problem: You can use the if/else/elif statements to check if, in this case, what the user enters in the input line. In addition of the statements you can use the break/continue keywords. For some reasons I'm not able to share the link of the lessons about the break, so I'm sharing links of codes examples, perhaps helpful :) https://code.sololearn.com/cw0SgnZds7pl/?ref=app https://code.sololearn.com/c7plkKFHvOiB/?ref=app If you want to learn more about the statements: https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2277/?ref=app https://www.sololearn.com/learn/Python/2278/?ref=app
25th Apr 2021, 4:10 PM
Matthew
Matthew - avatar
+ 4
May this code will help you while True : x=input() if x=='0': break
25th Apr 2021, 4:34 PM
Aman Jain
Aman Jain - avatar
0
Thanku
25th Apr 2021, 4:13 PM
...Mansi...
...Mansi... - avatar
0
Thanks all 😊
25th Apr 2021, 4:55 PM
...Mansi...
...Mansi... - avatar
0
1. if 2. 0 3. break
27th Aug 2021, 1:46 PM
PRINCE KUMAR
PRINCE KUMAR - avatar
0
i = 0 while True: print(i) i = i + 1 if i >5: break
15th Oct 2022, 11:17 PM
Mike Orogun
0
while True : x=input() if x=='0': break
2nd Nov 2022, 2:46 PM
SHREEMAN R
SHREEMAN R - avatar
0
if and is break
4th Jan 2023, 4:54 PM
Engr.Ayesha Liaqat
Engr.Ayesha Liaqat - avatar