112k views
4 votes
You wrote a program to allow the user to guess a number. Complete the code to generate a random integer between one and 10.

from random import randint
# Generate and save a random number
correct

1 Answer

4 votes
if we are talking about python

from random import randint
x = random.randint(1,10)
y = input(“enter a guess”)
if x == y:
print(“correct”)
else:
print(“incorrect, the answer was “, x)
User Luntegg
by
4.9k points