Simple input doubt

please help me what is wrong with this
Submission #3635285.Test cases 1 to 3 are failing

Hey,
please send your code on cb.lk/ide.

Thanks

Hi Mohit, Submitted my code here :

Hey,
You are taking input in a wrong way.
Input pattern should
4
6
8
9

And not 4 6 8 9
There is a \n after every input, which means you cannot use list comprehension for taking input since you are not getting all the inputs together.

Your algorithm should look like this:

sum =0
while sum>=0:
     x = int(input()) # take input in different lines
     sum+=x
     if (sum <0): # checking condition
           break
     print(x, end= " ")

I hope you will be able to implement now.
Thanks :slight_smile:

Thanks Mohit I was able to get it right … but the sample examples in the question needs to be changed it seems

Sample output shows values in next lines… but the code would produce results separated by a space " "

Try if the portal accepts solution in the different lines or single line…
I don’t remember exactly. In the first case you just need to remove the end = " "