Calculate the average of the numbers in the list

Assignment Help Business Management
Reference no: EM132261090

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: EM132261090

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
The data that jack has gathered qualitative in nature : Why are the data that Jack has gathered qualitative in nature? Describe three other techniques and/or sources to gather qualitative data.
What is being done to prevent sexual assault : The first would determine what is being done to prevent sexual assault on college campuses from occurring again in the future?
How complex organizations can be better perceived : The video A Systems Story provides an example of how complex organizations can be better perceived when applying a systems thinking perspective.
Calculate the average of the numbers in the list : 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)
Create a detailed diagram that maps the stock : Assignment Instructions Identify the structural, behavioral, and intersectional (relationship) attributes of your current or most recent employer's organization
Goal seek section of what-if analysis : What are the three parameters needed in the Goal Seek section of What-if Analysis? Explain each of them and what they do.
Explain how the issues identified are both private troubles : describe and evaluate the evidence provided. What information (facts, data, experiences, etc.) is the author using to support his argument?
Evaluate the moral intensity of issues faced by diem-thi le : Evaluate the moral intensity of the issues faced by Diem-Thi Le in her whistleblowing experience at DCAA.

Reviews

Write a Review

Business Management Questions & Answers

  Set of ethical values impacted its business

RJ Reynolds Tobacco Co., and conduct internet research on what actions it has taken to a particular set of ethics or beliefs and how that has impacted its business. How has it's polices and perceived set of ethical values impacted its business? Wo..

  Diverse medical needs-personal desires

Innovative long-term care services that meet the diverse medical needs, personal desires, and lifestyle choices of older Americans have made important strides over the years. What are two of these innovations?

  Elucidate communication technologies used by each bookstore

Elucidate the communication technologies used by each bookstore. Describe the m-commerce capabilities of each bookstore and how each conducts their m-commerce activities. What advantages and disadvantages does m-commerce provide for each booksell..

  Childhood education foundation theories

Why is it important to understand early childhood education foundation theories and how do they impact the field. Need in one hour.

  List factor that nlrb considers to determine bargaining unit

List factors that NLRB considers to determine a bargaining unit. The ______ removed unions from Sherman Act jurisdiction and limited use of federal injunctions.

  Financial analysis for a hospital project- you are working

financial analysis for a hospital project- you are working in the finance department at a large for-profit hospital in

  Present value of the firm growth options

A). What rate of return do Nogro's investors require? B). What is the present value of the firm's growth options?

  Identify two types of staffing models that could apply

Identify two types of staffing models that could apply to your chosen scenario and determine which model would be best suited for efficiency, productivity, and possible future growth.

  Find the court decision located

Find the court decision located at 2007-1 USTC ¶50,210. a. What court heard the case?

  Write a paper providing a summary of the given reading

Write a paper providing a summary of the reading. Writing a philosophy paper involves more than simply stating your opinions. You must support your views by presenting arguments in favor of them. You should also try to defend your views against pot..

  Thinking of investing in south africa

What are some financial structure risks and indicators when foreign companies are thinking of investing in South Africa.

  Determining the shortage of wheat

(a) Suppose the government imposes a price support (price floor) of P = 80. How much is the surplus of wheat? Show your work. (b) Suppose the government imposes a price floor of P = 35. How much is the shortage of wheat? Show your work.

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