Answer to Question #272307 in Python for comscie

Question #272307

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..

1
Expert's answer
2021-11-27T02:33:12-0500
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")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS