Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 2.06 KB

File metadata and controls

34 lines (26 loc) · 2.06 KB

🔍 Python Code Detective

Ever see those Twitter posts asking "What will this code output?" and feel totally lost? This interactive quiz teaches you the detective method for thinking through code step-by-step, so you can figure out any Python puzzle!

What you'll see

A colorful terminal quiz that walks you through Python code snippets with multiple choice answers. But here's the cool part! it doesn't just tell you if you're right or wrong. It teaches you exactly HOW to think through the problem like a detective, breaking down each line of code and showing you the methodology that works every time.

How to run this

cd python_detective
python3 python_detective.py

How it works

The program uses the "Detective Method" - a 6-step process for analyzing any Python code:

  1. Read the code line by line
  2. Track what each variable contains
  3. Follow the execution order
  4. Think about what each operation does
  5. Predict the final result
  6. Double-check your logic

Each question focuses on common Python concepts like variable assignment, string indexing, list operations, and built-in functions. Instead of trying to trick you, every explanation teaches you the thinking process, so you get better at reading code in general.

Try changing this

  • Add your own questions to the quiz_questions list with code snippets you find challenging
  • Modify the color scheme by changing the Colors class values
  • Add a timer feature to track how long each question takes
  • Create different difficulty levels with more complex code examples

What I learned

This project taught me so much about structuring data with lists and dictionaries! I discovered how powerful it is to break down complex problems into step-by-step methodologies. The biggest breakthrough was realizing that good programming isn't about syntax, it's about developing systematic thinking patterns.

Building the explanation system made me understand Python concepts way better than just reading about them. When you have to explain something clearly to someone else, you really have to understand it yourself!