Write a program that has 5 functions

Assignment Help Basic Computer Science
Reference no: EM131716306

The program is in Python

Write a program that has 5 functions. Name your functions based on its functionality. Avoid naming your function, funtion1, fucntion2, etc. For example, a function that converts inches to centimeters may be named inchTocm.

Function 1: This function accepts a string of characters and displays it 5 times on the screen. In your main function, you will show its usage.

Function 2: This function asks for 2 whole numbers such as 10 and 21 and display all of the odd numbers between the 2 parameters. In this case, the function will display 11 13 15 17 19 and 21. Calculate and return the total of the odd numbers. Call this function in the main function to show how it could be used.

Function 3: This function accepts as its parameter any number. The function will display the number followed by *****, followed by the number squared, followed by &&&&&, and followed by the number cubed. For example, if the parameter value is 5, the function will display 5***25&&&125. In your main function, call this function with as many numbers at the user wishes to enter. So, use a sentinel value. Note that the loop as OUTSIDE of the function.

Function 4: This function accepts the number of items to be entered by the user, asks for the indicated number of items and it calculates and returns the total of the numbers. Note that the loop that calculates the total is inside this function. If the value of the total happens to be more than 10 return -1. Otherwise, return the calculated total.

Function 5: (Don't let the MATH bother you! You just have to convert the formula into a program statement. This function calculates and returns the distance an object falls due to gravity in a specific time period. The formula is:

Distance = ½ * gravity * time2

The function accepts as parameters the value for gravity and the value for time the object has been falling. The function returns the value of distance. In your main function, use a loop to ask the user for a set of values for gravity and time and display the value for distance. For example, if the value of gravity is 9.8 and time is 10, distance will be 98.

Make sure to write code to show the usage of all of the functions you have created.

Reference no: EM131716306

Questions Cloud

How are you going to be doing the payroll calculations : How are you going to be doing the payroll calculations? What kind of data is going to be stored in your database?
Talent the founders say is essential to the company strategy : Skookum ensure it is hiring the kind of superior talent the founders say is essential to the company's strategy.
Explain how the history of cyber effort and cyber war impact : Explain how the history of the cyber effort and cyber war impact our national security and national intelligence?
Discuss about the population trimmed mean : For the data in Exercise, the trimmed mean is X t = 42.17 with a Winsorized standard deviation of sw = 1.73. Test the hypothesis that the population trimmed.
Write a program that has 5 functions : Write a program that has 5 functions. Name your functions based on its functionality. Avoid naming your function, funtion1, fucntion2, etc.
How many cars are needed to breakeven : For cars the unit sales were 120,000 and the contribution margin was $240,000. If fixed costs are $200,000 how many cars are needed to breakeven
Decision structure inside another decision structure : To test more than one condition, you can nest a decision structure inside another decision structure.
Evaluate various approaches to evaluating a training program : Evaluate various approaches to evaluating a training program and then create an implementable posttraining evaluation form to evaluate your results.
What are the explanations that have been offered : What are the explanations that have been offered in support of dropping the atomic bomb? What is your response to these explanations?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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