🕵️ Mystery Number Detective

Lesson 1: Your First Python Adventure

⏱️ Time: 15-20 minutes • 🎯 Goal: Learn variables and basic math

🎮 Try This Code!

# 🎮 Welcome to Python Adventure! 🎮
print("Hello! I'm your computer friend!")
print("Let's solve some mystery numbers! 🕵️")

# Your first mystery number
mystery_number = 7
print(f"I found a mystery number: {mystery_number}")

# The magic formula machine
magic_result = mystery_number * 2 + 1
print(f"My magic machine turned {mystery_number} into {magic_result}")

# Let's try another mystery number
another_mystery = 5
another_result = another_mystery * 2 + 1
print(f"The machine turned {another_mystery} into {another_result}")

print("🎉 Great job, Detective! You're learning programming!")

📋 Copy this code into Spyder:

  1. 1. Open Spyder from Anaconda Navigator
  2. 2. Copy the code above into the editor (left side)
  3. 3. Press F5 to run the code
  4. 4. Watch the magic happen in the console!

📊 Add Visual Magic

# Add this to see your mystery numbers as a graph!
import matplotlib.pyplot as plt

# Test different mystery numbers
mystery_numbers = [1, 2, 3, 4, 5, 6, 7, 8]
magic_results = []

for num in mystery_numbers:
    result = num * 2 + 1
    magic_results.append(result)

# Draw the pattern
plt.figure(figsize=(8, 5))
plt.plot(mystery_numbers, magic_results, 'ro-', linewidth=3, markersize=8)
plt.title("🎨 Mystery Number Pattern!")
plt.xlabel("Mystery Numbers Go In")
plt.ylabel("Magic Numbers Come Out")
plt.grid(True)
plt.show()

print("Look! Your mystery numbers make a straight line pattern!")

🎯 What You'll See:

A colorful graph showing how your mystery numbers follow a pattern! This is actually algebra - you're learning the equation y = 2x + 1!

🧩 Detective Challenge

Mystery #1:

If my magic machine turns 3 into 7, what does it turn 10 into?

🔍 Click for hint

The machine does: number × 2 + 1

Mystery #2:

Can you change the magic machine to multiply by 3 instead of 2?

🔍 Click for hint

Change "num * 2 + 1" to "num * 3 + 1"

🎓 What You Learned

Programming Concepts:

  • Variables: mystery_number stores a value
  • Operations: * for multiply, + for add
  • Print: Shows results on screen
  • f-strings: Put variables in text

Math Concepts:

  • Algebra: y = 2x + 1 (without knowing it!)
  • Patterns: Numbers follow rules
  • Functions: Input → Process → Output
  • Graphing: Visual representation of data