Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Scenario A junior magician has picked a secret number. He has hidden it in a variable named secret_number. He wants everyone who run his program

  • Scenario

    A junior magician has picked a secret number. He has hidden it in a variable named secret_number. He wants everyone who run his program to play the Guess the secret number game, and guess what number he has picked for them. Those who don't guess the number will be stuck in an endless loop forever! Unfortunately, he does not know how to complete the code.

    Your task is to help the magician complete the code in the editor in such a way so that the code:

  • will ask the user to enter an integer number;

  • will use a while loop;

  • will check whether the number entered by the user is the same as the number picked by

    the magician. If the number chosen by the user is different than the magician's secret number, the user should see the message "Ha ha! You're stuck in my loop!" and be prompted to enter a number again. If the number entered by the user matches the number picked by the magician, the number should be printed to the screen, and the magician should say the following words: "Well done, muggle! You are free now."

    The magician is counting on you! Don't disappoint him.

Sample Code: secret_number = 777

print( """ +================================+ | Welcome to my game, muggle! | | Enter an integer number | | and guess what number I've | picked for you. | | So, what is the secret number? | +================================+ """)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions