Answer the question
In order to leave comments, you need to log in
The output of all entered numbers, except 0, but the input can be continued after 0. I don’t understand: how to solve?
I beg you! Help solve this shit! I tried 3 different solutions, but none of them met ALL the requirements of the problem.
The user enters numbers one by one until they enter zero. The program should display the entered numbers until 0 is entered. No operations with numbers are performed.
Input format:
Integers are entered one after the other, on separate lines.
Output Format:
Prints entered numbers on separate lines until zero is entered
Example 1:
Input:
1
2
3
4
5
6
7
8
9
0
1
Output:
1
2
3
4
5
6
7
8
9
Example 2:
Input:
5
4
3
2
1
0
1
2
3
4
5
Output:
5
4
3
2
1
Please note! User input DOES NOT end with 0, but has the ability to continue! A task about the while loop.
Answer the question
In order to leave comments, you need to log in
Instead of input() read from sys.stdin as from a text file?
import sys
for line in sys.stdin:
... #обрабатываешь введённую строку
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question