given a list of numbers stop processing input after the cumulative sum of all the input become negative in python ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

given a list of numbers stop processing input after the cumulative sum of all the input become negative in python ?

All inputs are integers -1000 and 1000 Print all the numbers before the cumulative sum become nagative

8th Sep 2021, 10:51 AM
Avinash
Avinash - avatar
6 Answers
0
I think i mentioned above what was my question can you see thet
8th Sep 2021, 11:21 AM
Avinash
Avinash - avatar
0
Avinash You need to show your attempts first.
8th Sep 2021, 11:24 AM
A͢J
A͢J - avatar
0
Is there any option here to share screen short with you ?
8th Sep 2021, 11:29 AM
Avinash
Avinash - avatar
0
s=[] while True: n=int(input()) if n<1 or n>1000: break else: s.append(n) for i in s: print(i)
8th Sep 2021, 11:37 AM
Avinash
Avinash - avatar
0
Input= 1 2 88 -100 49 End expected output is 1 2 88
8th Sep 2021, 12:43 PM
Avinash
Avinash - avatar