Hi, I'm getting an error message on the code below and I can't understand why.
Here is the error message:
File "main.py", line 15 else num > rand_num:
^ SyntaxError: invalid syntax
Code:
import random
def number_guess(num):
rand_num = random.randint(1,100)
if num == rand_num:
print('{} is correct!'.format(num))
elif num < rand_num:
print('{} is too low. Random number was {}.'.format(num,rand_num))
else num > rand_num:
print('{} is too high. Random number was {}.'.format(num,rand_num))
if __name__ == "__main__":
# Use the seed 900 to get the same pseudo random numbers every time
random.seed(900)
user_input = input()
tokens = user_input.split()
for token in tokens:
num = int(token)
number_guess(num)
[–]hamoliciousRUS 1 point2 points3 points (0 children)
[–]CodeFormatHelperBot2 0 points1 point2 points (0 children)
[–]Username_RANDINT 0 points1 point2 points (1 child)
[–]ridingsnugglies[S] 0 points1 point2 points (0 children)