Modify and complete the function

Assignment Help Business Management
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()

Reference no: EM132252807

Questions Cloud

Describe four wireless technologies-standards : Describe what each one does and briefly how it works? How is each one different from the other standards? Why would you use one over the other?
Discuss about the evolving workplace technologies : Determine and Discuss about the evolving workplace technologies and influence of social media.
Prepare the applicable presentation on hand hygiene : Chosen topic: Hand hygiene, Select one of the following options for delivery and prepare the applicable presentation: PowerPoint presentation.
World trade organization prohibits the practice of dumping : To promote fair trade, the World Trade Organization prohibits the practice of dumping.
Modify and complete the function : 1. Complete the function asn2_1() so it prints the string that is passed to it as a parameter.
Compare and contrast the design and management : Connection between design and management of supply chains and its success has been noticed in supply chains - Compare and contrast the design and management
Training and development in banking sector : Training and Development in Banking Sector
Discuss article related to healthcare marketing innovations : Choose an article that is current(not older than 6 months) and is related to healthcare marketing innovations, health care marketing technology advances.
Identify what techniques you can implement to improve : Identify what techniques you can implement to improve the likelihood that your communications will be received and understood as you intended.

Reviews

Write a Review

Business Management Questions & Answers

  Apply critical thinking skills to team communication issues

Apply critical thinking skills to team communication issues.- explain why the barriers exist and how a team might overcome the barrier.

  Is the potential the similar across the districts

A sample of 200 sales yielded the following information. Using ChiSquare, is the potential the similar across the districts? Use alpha = 0.05

  Competitors and harm to competition policy

"There is a crucial distinction between harm to competitors and harm to competition policy should seek to protect the latter not the former.

  Organisational selection process and associated outcomes

Why must an organisation make sure that processes for advising applicants of the organisational selection process and associated outcomes ensure currency?

  Describing the ethical theories

Discuss the following theories/concepts: Utilitarianism, Rights and Justice, The Market System, Cost-Benefit Analysis, Kantianism, Egalitarian Theory, Libertarianism, and Virtue Ethics.

  Particular initiatives you would advocate

Are there any particular initiatives you would advocate? Why?

  Programming in the first year of employment

Assuming 176 hours per month and an 8 hour day, what is the true hourly cost of this trainee to the company for every hour actually spent programming.

  Potential costs and benefits of such an investment

What are the potential costs and benefits of such an investment? Think about the definition of stakeholders-any parties with a stake in the organization's actions or performance. Who are the stakeholders in this situation? How many can you list? On..

  What is price escalation and why does it occur

What is price escalation and why does it occur? Give a numerical example of how price escalation might happen for a U.S. exporter of headphones.

  Conduct a marketing audit for company

Based on your research and an interview with a Marketing Manager or executive, conduct a Marketing Audit for your company that reviews its brand

  Describe the company or organization and its mission

Type a brief (300 words) thorough and well - organized project proposal that clearly describes the company or organization and its mission in which the student will be assuming the role of the client

  Evaluate the quantitative methods effectiveness

Research how quantitative research is used in your discipline. Evaluate quantitative methods effectiveness with respect to certain areas within your discipline.

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