Complete The Function Asn2 1 So It Prints The String That Is Passed To It As A P

c.      Use asn2_3() to draw different-sized rectangles at locations (-150, 150), (-150, -150), (150, 150), (150, -150)

import turtle

def asn2_1(s):

  ”’Prints string s”’

  pass #This statement does nothing – you can delete it or leave it

def asn2_2():

  ”’

  Add a parameter – that parameter will be a list of numbers

  Return the average of the list

  ”’

  pass #This statement does nothing – you can delete it or leave it

#Add function asn2_3() to draw rectangles

  ”’

  asn2_3 takes the following parameters:

   a turtle and 4 integers; the integers are

   the length of horizontal side, the length of vertical side,

   x position of lower left corner, y position of lower left corner

  ”’

def main():

  #Get a string from the user; use asn2_1() to print it

  nums1 = [17, 12, 42, 11, 19] #This list will be sent to asn2_2()

  nums2 = [110, 212, 411, 256, 119, 57, 98] #This will be sent to asn2_2()

  #Get the average of nums1 by sending it to asn2_2()

  #Print the average of nums1

  #Get the average of nums2 by sending it to asn2_2()

  #Print the average of nums2

  wn = turtle.Screen()

  jacinda = turtle.Turtle()

  #Use asn2_3() to draw four rectangles, using jacinda, as…

  #…specified in the specs

main()

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply