Reference no: EM132252807
1. Complete the function asn2_1() so it prints the string that is passed to it as a parameter.
2. Modify and complete the function asn2_2() so it accepts one parameter-a list of numbers-and returns the average (rounded to 2 decimal places) of the numbers in the list. For full credit, use a loop to calculate the average of the numbers in the list.
3. Add a new function, asn2_3(), that draws a rectangle. The function should take five parameters: a turtle, the length of the horizontal side, the length of the vertical side, the x location of the bottom left corner, and the y location of the bottom left corner.
4. Complete the function main() to do the following:
a. Prompt the user for a string then call asn2_1() with that string as the argument; print the string in asn2_1().
b. You are given two lists, num1 and num2. Use asn2_2() to calculate their averages, then print those averages (calculate the average of each list using asn2_2() but print them in main()). 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() j
jacinda = turtle.Turtle()
#Use asn2_3() to draw four rectangles, using jacinda, as...
#...specified in the specs
main()