l=[]
while True:
a=int(input())
if a==42:
break;
else:
l.append(a)
print(l)
created
last reply
- 1
reply
- 557
views
- 2
users
l=[]
while True:
a=int(input())
if a==42:
break;
else:
l.append(a)
print(l)
I ran it with the input given in the problem, and it gave this:
[1, 2, 88]
instead of this
1
2
88
edit: You do understand that the outputs are passed to an automatic comparer right? It detects that your output doesn’t match the expected, and so you get WA.
It’s good practice to make your output match the format of the sample exactly. In many problems, an extra space here or there won’t matter, but in some problems, even an extra space will also cause WA.
Topic | Category | Replies | Views | Activity |
---|---|---|---|---|
What am i Missing | ProblemSet Archive | 1 | 146 | Feb 22 |
Getting TLE in AKBAR - Akbar , The great. Why? | ProblemSet Archive | 3 | 170 | Mar 11 |
COT - Count on a tree - TLE | ProblemSet Archive | 1 | 122 | Mar 18 |
AIBOHPHOBIA - LPS vs Direct Approach | ProblemSet Archive | 1 | 103 | Mar 31 |
ABCPATH - ABC Path | ProblemSet Archive | 1 | 75 | May 11 |