Question: 3. (6 points) Consider the following magic trick: - Think of any integer. Let's say we pick 12 . - Multiply the number by 4:124=48

3. (6 points) Consider the following "magic trick": - Think of any integer. Let's say we pick 12 . - Multiply the number by 4:124=48 - Add 36 to the previous result: 48+36=84 - Divide the previous result by 4:84/4=21 - Subtract the original integer from the previous result: 2112=9 The final result will always be 9 , regardless of the original number. It even works when the original number is negative! Such amaze. So wow. Write a program named questionable magic trick.py that simulates performing this trick. Your program should start by getting user input for the original number and storing that into a variable. You may assume that the user input is an integer. Then, change the value of that variable according to each step of the trick. After each step, print the result of that step on the screen. Use an integer division in the division step to avoid seeing any decimal points in the result. Do not make a new variable for each step of the trick. Instead, have your program change the value of the existing variable. You should need only two variables in all. Example program run (underlined parts indicate what the user enters) Example program run (underlined parts indicate what the user enters) You stand in the presence of the Magnificent Magic Mademoiselle Millicent. Prepare to be amazed! Enter an integer: 12 OK, watch this... We' 11 multiply by 4 and get 48 Then we' 11 add 36 and get 84 Then we' 11 divide by 4 and get 21 Then we'll subtract the original number and get... 9. Amazing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
