The test case is showing wrong

#given alist of number, stop processing input after the cumulative sum of the input becomes negative

a=[]
sum=0
b=int(input(“Enter the no of digits:”))
for x in range(b):
num=int(input(“Enter the digit:”))
a.append(num)

for x in range(b):

print(a[x])

sum=sum+a[x]

print(“the sum is”,sum)

if(sum>0):
    print(a[x])
else:
    break

here in first line and last line you are taking inputs and along with that your code is also printing the lines such as “Enter the no of digits:” and “Enter the digit:”, “the sum is” in print(“the sum is”,sum) and these are not required. Try removing them and also see the condition we have to break the loop when the sum is negative so we can also print n whenever the sum is zero.
Feel free to ask if you are not clear :slight_smile: Happy Coding !!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.