I am working on this Python assignment and it doesn’t work. Please I need your help. Thanks.
Write a program with a loop that asks the user to enter a series of positive numbers. The
user should enter a negative number to signal the end of the series. After all the positive
numbers have been entered, the program should display their sum.
Here is what I have so far:
Here is what I have so far: # main function def main(): # Local variables number = 1.0 #initialize for while loop total = 0.0 #continue adding numbers while they are positive while number > 0: number = float(input("Enter a positive number (negative to quit): ")) #check that number is positive so as not to change value #of the total if number > 0: total = total + number #Display total print ("Total = ", format(total, '.2f'))