Here's a fun mathematical trick that reveals a number between 1 and 10 through a series of calculations. The user performs operations on their chosen number, and the final result reveals the original number:
print("Multiply it by 5")
print("Add 25")
print("Multiply by 2")
print("Subtract 50")
result = int(input("Now, what's your final number? "))
original = result // 10
print(f"Your secret number was: {original}")
How It Works:
- User thinks of a number (e.g.,
7). - Multiply by 5:
7 × 5 = 35 - Add 25:
35 + 25 = 60 - Multiply by 2:
60 × 2 = 120 - Subtract 50:
120 - 50 = 70 - Final input: User enters
70. - Calculation:
70 // 10 = 7(original number revealed).
Key Insight:
The operations transform the original number x into 10x + 50 - 50 = 10x. Dividing by 10 (// 10) extracts x.
Try It Yourself:
- Run the code.
- Follow the instructions with your number.
- The program reveals your original number!
Example Output:
Think of a number between 1 and 10 (keep it secret!)
Multiply it by 5
Add 25
Multiply by 2
Subtract 50
Now, what's your final number? 70
Your secret number was: 7
Request an On-site Audit / Inquiry