Modify and complete the function asn2

Assignment Help Business Management
Reference no: EM132265546

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()

Reference no: EM132265546

Questions Cloud

What was the security breach in the scenario : From a security perspective, would you use your social security number in advertising? What was the security breach in the scenario?
Fill in the gant chart based on conditions : Fill in the Gant chart based on these conditions: (P, V, and context switch operations are instantaneous).Process P1 starts at time 0; P2 at time 3
Who were its major leaders and other influential members : Public source websites are defined as websites that allow members from the public to add content regardless of credentials or qualifications.
How KPI and Artificial intelligence have helped : Need content on atleast 4 mobile apps, how KPI and Artificial intelligence have helped them to build. Need around 15-16 slides apart from the intro.
Modify and complete the function asn2 : 1. Complete the function asn2_1() so it prints the string that is passed to it as a parameter.
What are the three parameters needed in the goal seek : What are the three parameters needed in the Goal Seek section of What-if Analysis? Explain each of them and what they do.
Topic of net neutrality : Conduct a SWOT analysis by analyzing the strengths, weaknesses, application opportunities, and threats from competitors of the chosen topic.
What are main processes involved in project time management : What are the main processes involved in project time management? In your words please describe them to help students in high school to perform their final.
Identify and explain security and counter-terrorism measures : Identify and explain security and counter-terrorism measures in relation to your selected type of terrorism.

Reviews

Write a Review

Business Management Questions & Answers

  The justice department prosecuted under the act

The Justice Department prosecuted under the act, claiming that the merger would establish a violation of the antitrust laws

  Walmart and amazons organizations strategies

Explain how IT help influence Walmart and Amazons organizations strategies.

  Best conflict mode or strategy

What is the best conflict mode or strategy you should adopt in this instance to persuade your boss to assign the important project to you? Is there more than one mode or strategy you should consider? Explain your answer.

  Case study of rockwell automation inc

Rockwell Automation, Inc. is the world's largest provider of industrial automation and information solutions headquartered in Milwaukee, Wisconsin.

  What is the role of effective corporate governance

What is the role of effective corporate governance in improving a firm's performance? What are some of the key governance mechanisms that are used to ensure that managerial and shareholder interests are aligned?

  Compare public and private sector leadership theories

Compare public and private sector leadership theories. How the three functions of successful leadership described in the Chemers article image management.

  What organizational changes have the companies made

What organizational changes have the companies made in the last five years? What do you believe prompted those changes?

  Explain the advantages and disadvantages of economic system

Write a 525-word (minimum) reflection that includes the following: Identify the economic system discussed in your collaborative discussion. Explain the advantages and disadvantages of this economic system.

  Charge of anywhere hospital compliance program

You are in charge of Anywhere Hospital's compliance program. As part of the Hospital's orientation program

  Professional working in a mid-size engineering firm

Imagine yourself as an HRD professional working in a mid-size engineering firm. Of the 3,000 employees in the organization

  Buyers perceptions of a product and its price are an

buyers perceptions of a product and its price are an important influence on pricing. value consciousness price

  Explain your answer using microeconomic theory

When wages increase, will the typical person work more or less? Explain your answer using microeconomic theory.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd