- 1
error pyhton code
#python 2.7.6 import random x = random.randint(0,100) if x > 53 print('You Won!') elif x <= 53 print('You Lost.') elif x == 53 print('Drow.') exit() output: File"source_file.py", line 7 if x > 53 SyntaxError:^invalid syntax
4 Réponses
+ 2
A colon is missing after if statement.
if condition:
statements
elif condition:
statements
else:
statements
+ 1
thank you
+ 1
in elif you have =. You don't need second elif or =< in first elif.
if x > 53:
statements
elif x < 53:
statements
else:
statements
+ 1
import random
x = random.randint(0,100)
if condition:
print('You Won!')
elif condition:
print('You Lost.')
else:
print('Drow.')
exit()
output:
file"source_file.py" line 8
print('You Won!')
^
indetation error: expected an indented block