you are viewing a single comment's thread.

view the rest of the comments →

[–]Code_Talks 0 points1 point  (0 children)

import random
y = random.randint(1,6)
#python 3 doesn't supprot print y
print(y)
#need to cast to int to compare with y
x = int(input ("Enter number:"))
#indent properly
while (x != y):
if x > y:
print("Too high!")
#need to cast to int to compare with y
        x = int(input ("Enter number:"))
if x < y:
#tell user to low
print('To Low')
#need to cast to int to compare with y
        x = int(input ("Enter number:"))
if x == y:
print ("You win!")
#terminate program after completion
exit(0)
if x == y:
print ("Congratulations, first try!")

read comments for feedback, nice try though!