I am having a problem with a simple program I made.
JavaScript
x
9
1
num2 = 0
2
num1 = 1
3
print ("Enter a number one after another to sum them up, and when you're done type 0")
4
while num1 != 0:
5
num1 = float(raw_input ("Please enter a number:")
6
num2 += num1
7
if num1 == 0:
8
print ("The sum of the numbers is:" + str(num2))
9
For some reason the line num2 += num1
gives me a syntax error on num2
.
Advertisement
Answer
You missed one )
, closing parenthesis, here:
JavaScript
1
2
1
num1 = float(raw_input ("Please enter a number:")
2
should be
JavaScript
1
2
1
num1 = float(raw_input ("Please enter a number:"))
2