I'm trying to write a small program to calculate numbers from the user. There's also some conditions to check if the number is positive or the user just hits enter. For some reason, I can't get the data variable to convert into a float.
The error occurs on line 5 where I get the error "ValueError: could not convert string to float:" I've tried so many combinations now, and tried to search StackOverflow for the answer, but without any luck.
How can I convert the input into a float? Thanks in advance for any help!
sum = 0.0
while True:
    data = float(input('Enter a number or just enter to quit: '))
    if data < 0:
        print("Sorry, no negative numbers!")
        continue
    elif data == "":
        break
    number = data
    sum += data
print("The sum is", sum)
 
     
     
     
    