Solved

Case Study 2: Def Sierpinski(myTurtle, P1, P2, P3, Depth)

Question 29

Multiple Choice

Case Study 2:
def sierpinski(myTurtle, p1, p2, p3, depth) :
if depth > 0:
sierpinski(myTurtle, p1,
midPoint(p1, p2) , midPoint(p1, p3) , depth - 1)
sierpinski(myTurtle, p2,
midPoint(p2, p3) , midPoint(p2, p1) , depth - 1)
sierpinski(myTurtle, p3,
midPoint(p3, p1) , midPoint(p3, p2) , depth - 1) else:
drawTriangle(myTurtle, p1, p2, p3)
-Refer to the session in the accompanying Case Study 2. Which of the following lines correctly implements the midPoint function: def midPoint(p1, p2) ?


A) return ((p1[0] + p2[0]) /2.0, (p1[1] + p2[1]) /2.0)
B) return ((p1[1] + p2[1]) /2.0, (p1[1] + p2[1]) /2.0)
C) return ((p1[0] + p2[0]) /3.0, (p1[1] + p2[1]) /3.0)
D) return ((p1 + p2[0]) /2.0, (p1 + p2[1]) /2.0)

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions