In this prelab you will formulate some of the ideas necessary to complete Lab 06. Because we have an exam coming up, the last question has nothing to do with the lab; it is simply here to help you prepare for the exam.
For the following two problems, work out by hand what the function will do. If you want to check your answers by typing them into Python, that is fine, but you need to be able to think about recursive functions without running them..
def strange(x) : if x <= 0 : return 1 else : return 5 * strange(x-1) - 2
def weird(x) : if x > 0 : print(x,"",end='') if x%2 == 0 : weird(x-3) weird(x-2) else : weird(x-1)
Consider the following figure.
Let (Ax, Ay) be the coordinates of point A, (Bx, By) those of point B, and (Cx, Cy) those of point C. The points P, Q and R are the midpoints of the three edges of the big triangle.
The following question has nothing to do with the lab or with recursion. This will give you some practice writing code on paper, which is a skill that a lot of beginning programming students struggle with.
If you followed the Honor Code in this assignment, write the following sentence attesting to the fact at the top of your homework.
I affirm that I have adhered to the Honor Code in this assignment.