LMU ☀️ CMSI 1010
COMPUTER PROGRAMMING LABORATORY
Exam 2
  1. Write a recursive Python function to determine how many times you can divide a number by 3 before it becomes less than 1.
  2. (Here is a challenge that you hopefully already did!) For the Person class in the Family Archives lab, write a method to return a list of all of the known grandparents of a person. You should return a list of between zero and four people.
  3. Write a dataclass in Python to represent a point in 3D space. Give the dataclass a __str__ method to display the coordinates in a readable format, e.g. (5.0, 2.5, -3.8), and a method called distance_to_origin that returns the distance from the origin to the point.
  4. Write a Pygame program that draws a circle on the screen and allows the user to move it with the arrow keys.
  5. Write a Pygame program in which a rectangle that has a thick magenta border and a cyan interior moves diagonally across the screen, from the upper left corner to the lower right corner. Clicking the mouse button will reset the rectangle to the upper left corner.