l=[]
while True:
a=int(input())
if a==42:
break;
else:
l.append(a)
print(l)
created
last reply
- 1
reply
- 556
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 is wrong in my code…. i’m continuously getting runtime error(SIGSEGV)COT - Count on a tree | ProblemSet Archive | 4 | 190 | Feb 20 |
What am i Missing | ProblemSet Archive | 1 | 146 | Feb 22 |
Beangame | ProblemSet Archive | 2 | 113 | Apr 9 |
ABCPATH - ABC Path | ProblemSet Archive | 1 | 75 | May 11 |