- 1

BREAK IN LOOPS exercise question in Python

How do I solve this? Thanks. items = [] while True: n = int(input()) items.append(n) Change the code to end the loop when the user enters 0. Output the resulted list after the while loop ends. Sample Input 1 2 3 0 Sample Output [1, 2, 3]

8th Jun 2021, 7:25 AM
Frank
1 ответ
+ 4
items = [] while True: n = int(input()) if n==0: break items.append(n) print(items)
8th Jun 2021, 7:27 AM
Prashanth Kumar
Prashanth Kumar - avatar
Актуальное сегодня
.
1 Votes
What?
0 Votes
HTML
0 Votes
Quiz duel
0 Votes
Web
0 Votes
FRC Coding?
1 Votes
help
0 Votes
AI
2 Votes