Problem 170184 · easy · Level 01 Prerequisites & Setup

Which Quadrant?

conditionals · boolean logic

Write quadrant(x, y) that returns which quadrant of the coordinate plane the point (x, y) lies in: 1 (both positive), 2 (x negative, y positive), 3 (both negative) or 4 (x positive, y negative). If the point lies on either axis (x or y is 0), return 0.

Examples

Input:  x = 3, y = 4
Output: 1

Input:  x = -2, y = 5
Output: 2

Input:  x = 0, y = 7
Output: 0

Constraints

  • -1000 <= x, y <= 1000

Goals

  • Combine the signs of two numbers with and
  • Treat points on an axis as a separate case
Starting Python…