Can't get this to work

0 Everett Gally · May 21, 2015
Hi i am new to python and this is a guessing game it won't print correct when i enter the number that it randomly selects.

Here is the code.

from random import randint

Number = randint(1, 100)

print(Number)


def guess():

input("Try to guess the number\n")


if input == Number:
print("Correct")


guess()

Post a Reply

Replies

Oldest  Newest  Rating
+1 Pavel Dimi · May 21, 2015
from random import randint

Number = randint(1, 100)
print(Number)


def guess():
    input_number = input("Try to guess\n")
    return int(input_number)


if Number == guess():
    print("Correct")
else:
    print("Bad trip")
0 Everett Gally · May 22, 2015
Thank you Pavel Dimi that helped a lot
  • 1

Python

107,281 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator