1. Write a Python program for a guessing game. The program allows the
user to enter a number to guess a secret number. Assuming that the
secret number is 143, it provides a feedback that will display a message
“ Congratulation !!!You got the number...” if the user successfully
guessed the secret number otherwise it will display a message “Sorry,
better luck next time..”.(you can assign any number for the secret
number)
Sample outputs(assuming the secret number is 143)
Enter your guess number: 123
Sorry, better luck next time…
Enter your guess number : 143
Congratulation !!!You got the number..
sec_num = int(input("Enter a secret number: "))
inp = int(input("Enter a guess number: "))
if inp == sec_num:
print("Congratulation !!!You got the number.")
else:
print("Sorry, better luck next time")
Comments
Leave a comment