Write code to show the usage of all of the function you have

Assignment Help Python Programming
Reference no: EM132356642

Question

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

Questions Cloud

Give an example of a company culture : From your own observations, give an example of a company's culture being a strength or a weakness. In what ways was it a strength or weakness?
What is the cost SportStuff incurs : CASE STUDY - Managing Growth at SportStuff. What is the cost SportStuff incurs if all warehouses leased are in St. Louis\
Building an ms paint like application in java : Opportunity to apply the object-oriented software development skills you have acquired during the course to a significant but moderately-sized application
The principal liability on the contract : Crash agrees to have Steve represent him in various transactions as an agent to secure him performance contracts and endorsement deals.
Write code to show the usage of all of the function you have : This function accepts a string of characters and displays it 5 times on the screen. In your main function, you will show its usage.
How learning in course contribute to your effectiveness : Counseling and psychological treatments have evolved over the past century. New theories and practical methods are being developed that will aid in the.
Explain the concept of a hedge : ACC00145 Financial Reporting Assignment Southern Cross University Australia. Explain concept of a hedge. Discuss advantages or disadvantages of hedge accounting
What were the characteristics and mood of the team : For the first paragraph of your initial post select one of the three scenarios below. Describe in detail how you would use your knowledge of emotional.
Necessary activities-key decisions to start small business : Describe and analyze the necessary activities and key decisions to start a small business. Small business management using proper writing mechanics.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

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