3. Consider the python statements:
import time
class Face:
def __init__(self, outline, eyeL, eyeR, nose, mouth):
self.eyeL = eyeL
self.eyeR = eyeR
self.nose = nose
self.mouth = mouth
self.outline = outline
self.background = 'cyan'
self.foreground = 'black'
def wink(self, length):
self.eyeL.setFill(self.background)
time.sleep(length)
self.eyeL.setFill(self.foreground)
def makeFace(win):
c = Circle(Point(100,100),80)
c.draw(win)
e1 = Circle(Point(30,60),15)
e1.draw(win)
e2 = e1.clone()
e2.move(40,0)
e2.draw(win)
n = Circle(Point(50,40),10)
n.draw(win)
m = Rectangle(Point(30,15),Point(70,25))
m.draw(win)
f = Face(c,e1,e2,n,m)
In function makeFace(), how do I get the left eye to:
wink 3 times for 2 seconds per wink then
wink 3 times for 1 second per wink? |
for i in range(3):
f.wink(2)
f.wink(1)
for i in range(2):
f.wink(3)
for i in range(1):
f.wink(3)
for i in range(3):
f.wink(2)
for i in range(3):
f.wink(1)
none of the above
|