Reputation:
b = 0
for a in range(0, 10, 2):
b += a − 1
print(a," ",b)
I am practicing on a past paper. Please help. And can someone please explain the break and continue functions.
Upvotes: 0
Views: 47
Reputation: 107287
Character −
is not a correct python identifier for minus operator, you need -
instead:
>>> 3 − 1
File "<stdin>", line 1
3 − 1
^
SyntaxError: invalid character in identifier
>>>
>>> 3 - 1
2
It's actually a unicode with code point 8722:
>>> ord('−')
8722
Upvotes: 1