CPSC120A
Fundamentals of Computer Science I

Post-lab 16

Chained Conditionals

Do one of the following programming problems:

Circle Overlap

Create a function called are_circles_overlapping(circle_1_x, circle_1_y, circle_1_radius, circle_2_x, circle_2_y, circle_2_radius) in a file called circle_overlap.py. The function should return True if the circle centered at (circle_1_x, circle_1_y) with a radius of circle_1_radius is overlapping with the circle centered at (circle_2_x, circle_2_y) with a radius of circle_2_radius. The function should return False otherwise. Consider two circle touching to be not overlapping.

You can compute whether two circles are overlapping by determining if the center points of the circles are within the sum of the circle radii.


Point In Rectangle

Write a function called point_in_rectangle(point_x, point_y, rect_x, rect_y, rect_width, rect_height) that returns True or False depending on whether the point (point_x, point_y) is inside of the rectangle with the center (rect_x, rect_y) and dimensions (rect_width, rect_y). Assume that a point precisely on the edge of the rectangle is not inside of the rectangle.