Determine Quadrant
Take coordinates (x, y) and determine which quadrant the point lies in.
IntermediatePhase 1 - Level 3: Math and Number LogicExample 6 of 10
determine-quadrant.py
1# Take coordinates2x = float(input("Enter x coordinate: "))3y = float(input("Enter y coordinate: "))45# Determine quadrant6if x > 0 and y > 0:7 print("Quadrant I")8elif x < 0 and y > 0:9 print("Quadrant II")10elif x < 0 and y < 0:11 print("Quadrant III")12elif x > 0 and y < 0:13 print("Quadrant IV")14elif x == 0 and y == 0:15 print("Origin")16elif x == 0:17 print("On Y-axis")18else:19 print("On X-axis")
Output
Enter x coordinate: 3 Enter y coordinate: 4 Quadrant I Enter x coordinate: -2 Enter y coordinate: 5 Quadrant II
What's going on
Check signs of x and y to determine quadrant.
Key Concepts:
Quadrant I: x > 0, y > 0
Quadrant II: x < 0, y > 0
Quadrant III: x < 0, y < 0
Quadrant IV: x > 0, y < 0
Handle axes and origin separately
🔗Related Content
- 📖
Phase 1 - Learn Concepts
Review Phase 1 concepts and explanations
- 📝
Phase 1 - Quiz
Test your Phase 1 understanding with quiz questions
- 💻
Phase 1 - All Practice Problems
Explore all practice problems for Phase 1
- 🎓
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- 🧠
Logic Building Overview
Learn about the complete logic building curriculum