Modify and complete the function

Assignment Help Business Management
Reference no: EM132256309

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

  jacinda = turtle.Turtle()

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

  #...specified in the specs

main()

Reference no: EM132256309

Questions Cloud

Design and implement an immutable fraction class : Design and implement an immutable Fraction Class described in the Fraction case study. Your class must have the following methods to emulate arithmetic
How can the given resistance be overcome : What are the basic reasons that people resist change? How can this resistance be overcome? Include at least 300 words in your reply.
What information was relevant and why : How are the topics of the two articles related to the topic? What information was relevant and why?
What accounting problem that the Linbarger Company faces : Assignment - Ethics in Accounting. What is the accounting problem that the Linbarger Company faces? What are the ethical considerations in this case
Modify and complete the function : 1. Complete the function asn2_1() so it prints the string that is passed to it as a parameter.
Average number of voters in the system with voter booths : What is the average number of voters in the system with 5 voter booths?
Describe the security and privacy requirements : Describe the security and privacy requirements for the network boundary. hat are all of the documents we will need to have prepared for the upcoming audit?
Describe the disaster recovery and business continuity : Conduct a web search on organizations that were affected by Hurricane Katrina. Please select one business and cover the following.
Budgeting process for indirect costs and functional account : "The budgeting process for indirect costs and functional account expenses is more difficult than for direct costs and natural account expenses."

Reviews

Write a Review

Business Management Questions & Answers

  Concentrated benefits-dispersed costs

Briefly explain what it means and then give an example of applying it to say, farm price supports.

  What must he sell there to meet his quota

Jim sells college textbooks. To date Jim has sold $141,002 worth of textbooks. His sales quota is $194,159. Tomorrow he expects to sell $15,005 worth of textbooks to B College. His last stop will be Munroe College. What must he sell there to meet ..

  Why did it made a comeback in the 1990

1) Why did strategic management become unpopular in the 1970s? 2) Why did it made a comeback in the 1990s?

  Sqm implementation plan

Detail personality differences that create a hostile working environment. What are organizational processes that can identify hostile working environments? How does diversity create hostile working environments?

  Culture of ethical business behavior

Identify an organization that you have worked for or know about that has successfully implemented a culture of ethical business behavior. Alternatively, identify one that has not successfully implemented a culture of ethical business behavior.

  What are a few of the most important factors

What are a few of the most important factors in step 6 (Formulating Strategies and Plans to Manage the Issues) that are important to the ten-step strategic plan

  Case study to evaluate training needs

How would you evaluate that the designed training accomplished its objectives? How would you convince top management that it would be worth it?

  Specific forms of workplace discrimination

Evaluate the specific forms of workplace discrimination prohibited under current statutory and case law. Assess the classes of people protected by current employment law

  What competencies does the leader have that are strengths

What competencies does the leader have that are strengths? What competencies might be lacking or are weaknesses? Is the team marked by resonance (positive emotions) or dissonance (negative emotions)?

  Calculate the optimal quantity of oranges

Calculate the optimal quantity of oranges John should buy on Monday morning to serve customers during the week, the expected units short,

  Conditioning and cognitive learning theory

Describe an attitude a consumer recently developed toward a product or service in terms of classical conditioning, instrumental conditioning

  Results of a nlrb election

Is it an unfair labor practice to refuse to accept evidence of majority status other than the results of a NLRB election?

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