0% found this document useful (0 votes)
14 views

Code

The document describes a simple game where a random number is generated between 1 and 10 and the user guesses the number, if the guess matches they win otherwise they lose.

Uploaded by

Yash Kumar Singh
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Code

The document describes a simple game where a random number is generated between 1 and 10 and the user guesses the number, if the guess matches they win otherwise they lose.

Uploaded by

Yash Kumar Singh
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import random

#Dumb luck game


print ("If your guess matches the randomly generated number, you will win the game,
else you will lose.")
random_int = random.randint(1, 10)
user_input = int(input("Guess a number from 1 to 10!: "))
if user_input<0 and user_input>10:
print ("Enter a valid input!")
else:
print ("Enter a number between 1 and 10!")
if user_input == random_int:
print ("Your guess is correct, you have won!")
else:
print ("Oops! Your guess is wrong!")

You might also like