about | help | code help+videos | done | prefs |
Define a function that when passed 6 parameters (I know, it's a bit more than we'd usually like), representing, 1. x-coordinate of top-left point of first square 2. y-coordinate of top-left point of first square 3. length of each side of first square 4. x-coordinate of top-left point of second square 5. y-coordinate of top-left point of second square 6. length of each side of second square returns True if the two squares overlap (even by a little bit). NOTE: Consider the origin to be at the top-left of the plane (not like the Cartesian plane). So the y-axis increases going downwards. For example, a square with side 10 and top-left corner at (10, 20) and a square with side 5 and top-left corner at (20, 25), share one point in common (20, 20), so they do overlap. squares_overlapping(10, 20, 10, 20, 30, 5) → True squares_overlapping(20, 50, 30, 40, 90, 10) → False squares_overlapping(20, 50, 30, 40, 70, 10) → True ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 5 Post-solution available
Copyright Nick Parlante 2017 - privacy