Why is the syntax wrong on line 17? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
4th Feb 2018, 3:11 PM
Raphael Shay
Raphael Shay - avatar
3 Antworten
+ 4
u missed a closing brace above the else and in line 24 u cant start directly elif so remove that and type just if and u r good to go
4th Feb 2018, 3:18 PM
Suhail Pappu
Suhail Pappu - avatar
+ 3
# Creator - Raphael Shay # Upvote import random x = input() y = random.randint(0, 10) t = str(x) + str(y) def problems(): if str(x) > str(10): print(("Please input a 1 digit number.")) else: print("You chose the number " + str(x) + ",") print("the computer chose the number " + str(y) + ".") problems() def oddOrEven(): if int(t) % 2 == 0: print("The number is even.") elif int(t) % 2 == 1: print("The number is odd") oddOrEven()
4th Feb 2018, 3:47 PM
Uzair Ahmad
Uzair Ahmad - avatar
+ 1
How can I code if i want to know about any number. Is it possible If the only the last digit of a number (any length) is tried with no remainder and declared as even. else odd?
4th Feb 2018, 3:54 PM
Uzair Ahmad
Uzair Ahmad - avatar