MASTER YOUR LOGIC BUILDING:Phase 1 - Level 5: Creative / Tricky Logical Scenarios
Mastering phase 1 - level 5: creative / tricky logical scenarios concepts and implementation.
Phase 1 - Level 5: Creative / Tricky Logical Scenarios
Why This Matters
Real problems rarely say "write an if statement." They say things like: "Where does this point fall on a graph?" or "Do these three numbers form a right triangle?" You have to translate a story into logic — and that's the skill that separates beginners from confident programmers.
This level is your first taste of that. The problems look tricky, but each one breaks down into simple steps you already know.
What You'll Learn
- How to handle special cases before general ones
- How to work with coordinates (x, y points on a graph)
- How to check mathematical relationships with conditions
- A reliable problem-solving process for "scary" problems
Your Problem-Solving Recipe
Every tricky problem follows the same pattern:
- Read carefully — what are the inputs? What should the output be?
- List special cases first — origin, axes, zero, equal values
- Handle special cases — usually with
if / elifat the top - Handle the general case — the "normal" logic
- Test — try edge inputs: 0, negative numbers, equal values
"First think in plain English. Then write one condition at a time."
Example: Where Is a Point on a Graph?
Given coordinates (x, y), you might need to find the quadrant — or notice the point sits on an axis or at the origin.
Step-by-step thinking:
- Is x = 0 and y = 0? → Origin
- Is x = 0? → On the Y-axis
- Is y = 0? → On the X-axis
- Both positive? → Quadrant I
- x negative, y positive? → Quadrant II
- Both negative? → Quadrant III
- Otherwise → Quadrant IV
if x == 0 and y == 0:
print("Origin")
elif x == 0:
print("On Y-axis")
elif y == 0:
print("On X-axis")
elif x > 0 and y > 0:
print("Quadrant I")
# ... and so on
Key insight: Check the weird cases (origin, axes) before the quadrants.
Example: Pythagorean Triplet
Three numbers (a, b, c) form a Pythagorean triplet if a² + b² = c² — but you don't know which number is the longest side (hypotenuse).
Step-by-step thinking:
- Try a² + b² = c²
- Also try b² + c² = a²
- Also try a² + c² = b²
- If any of these is true → it's a triplet
is_triplet = (
(a*a + b*b == c*c) or
(b*b + c*c == a*a) or
(a*a + c*c == b*b)
)
Use or because only one arrangement needs to work.
Common Mistakes
- Jumping to the general case — forgetting origin (0,0) or axis points
- Assuming which side is the hypotenuse — always check all three arrangements
- Trying to write everything in one giant `if` — break it into steps
- Not testing edge cases — always try 0, negatives, and equal values
Tips
- Draw a picture for geometry problems — even a rough sketch helps
- Write comments for each case in plain English before coding
- If stuck, solve one small piece first (e.g., just detect the origin)
- It's okay if your first attempt isn't perfect — refactor step by step
Practice Focus
Tackle the examples below using the recipe above:
- Quadrant detection — special cases first, then quadrants
- Pythagorean triplet — check all three side arrangements with
or - Time yourself thinking in English before typing any code
Hands-on Examples
Determine Quadrant
# Take coordinates
x = float(input("Enter x coordinate: "))
y = float(input("Enter y coordinate: "))
# Determine quadrant or axis
if x == 0 and y == 0:
print("Origin")
elif x == 0:
print("On Y-axis")
elif y == 0:
print("On X-axis")
elif x > 0 and y > 0:
print("Quadrant I")
elif x < 0 and y > 0:
print("Quadrant II")
elif x < 0 and y < 0:
print("Quadrant III")
else:
print("Quadrant IV")Check for special cases first (origin, axes), then check sign combinations for quadrants.
Related Page
🔗Related Content
- 💻
Phase 1 - Practice Problems
Practice Phase 1 concepts with hands-on coding problems
- 📝
Phase 1 - Quiz
Test your Phase 1 understanding with assessment questions
- ➡️
Phase 2 - Get Started
Continue to Phase 2 after mastering Phase 1
- 🎓
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- 🧠
Logic Building Overview
Learn about the complete logic building curriculum