Why doesn't my code work?

i kept getting a syntax error around the else: statement. can anyone tell me what is wrong with my code?
the solution appears to be a carbon copy of what I typed in.
def not_sum_to_ten(num1, num2):
if num1 + num2 != 10:
return True
return False

Please use the </> icon to post your code properly indented, so that it is readable as Python.

To code looks fine so that would suggest an indentation problem.

if ...:
    return ...
    return ...

Don’t you need quotations around “True” and “False”?

That would make them string primitives. To be actual Boolean primitives they need to be written expressively, without quotes.


I guess I’m confusing it with another lesson, because I’ve seen quotes around them before. Tks…

1 Like

I figured it out also by using the sum( ) function, but we have not learnt that yet I believe.