#558 · Python Basics · Beginner · 30 XP · about 4 min
The x-axis and the y-axis cut a graph into four parts called quadrants:
Write quadrant(x, y) that returns the number of the quadrant the point (x, y) is in. A point that sits on an axis, where x or y is 0, is in no quadrant: return 0 for it.
quadrant(3, 5) # returns 1 quadrant(-2, 4) # returns 2 quadrant(-1, -1) # returns 3 quadrant(0, 7) # returns 0
x and y can be whole numbers or decimals.
First solves only, ranked by stars and then time.