+ 1

Why doesn't this work?

i = 0 total = 0 while i < 5: age = int(input()) i += 1 if age <3: continue else: total += 100 print (total) I also tried breaking an infinite 'while True' loop instead: if i < 5: print (total) break

21st Sep 2022, 9:11 AM
Lin
Lin - avatar
2 Antworten
+ 7
In sololearn we need to input every input at once, then this data is send to server and then we receive output data. But you keep asking for age input in while loop, also there is no reason to place this inside loop, move it outside and ask only once. You can use online compiler or compiler on your pc to run code what need to handle data in this way. https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
21st Sep 2022, 9:30 AM
PanicS
PanicS - avatar
+ 10
Hi! Your program works without errors and passes all tests in the assignment of the python course lesson for beginners
21st Sep 2022, 9:27 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar