Skip to content
Advertisement

write a program that reads positive numbers from the user and stops if the user entered negative numbers

I am quite new to Python so I am having trouble doing my assignment. I need to create a program that adds an unspecified amount of positive numbers entered by the user, and the program will stop if the user entered a zero or a negative number. Then it prints out the total. I think the problem with my code is that it doesn’t loop. Please help me with this, thank you.

JavaScript

Advertisement

Answer

Your logic and syntax has some errors and it’s hard to follow. Hope this code snippet below can help you:

JavaScript

running (and input number)

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement