Ask your own question, for FREE!
Computer Science 13 Online
hlubi:

I need help with Python computers. With Else statements. num = 8 if num == 1: print("One") else: if num == 2: print("Two") else: if num == 7: print("seven") else: if num == 8: print("eight") the program is saying there is an invalid syntax.

darkknight:

actually 26 % 2 is evaluated to 0...

Vocaloid:

@hlubi you cannot use the if else for multiple conditions. you need to use elif instead. if condition 1: elif condition 2: elif condition 3: else: (indent) if last condition:

Vocaloid:

if you're still stuck I can send you a pic of the code I re-wrote but I'd like you to give it a try first

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!