1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
enot [183]
2 years ago
7

Write a function so that the main program below can be replaced by the simpler code that calls function mph_and_minutes_to_miles

(). Original main program: miles_per_hour = float(input()) minutes_traveled = float(input()) hours_traveled = minutes_traveled / 60.0 miles_traveled = hours_traveled * miles_per_hour print('Miles: %f' % miles_traveled) Sample output with inputs: 70.0 100.0 Miles: 116.666667
Computers and Technology
1 answer:
Blababa [14]2 years ago
4 0

Answer:

Here is  code in python .

#function to calculate miles traveled

# pass two parameter in the function "miles_per_hour" and "minutes_traveled"

def mph_and_minutes_to_miles(miles_per_hour, minutes_traveled):

# convert minutes to hours

   hours_traveled = minutes_traveled / 60.0

   #calculate total miles traveled

   miles_traveled = hours_traveled * miles_per_hour

   #return the value

   return miles_traveled

#read input from user

miles_per_hour = float(input())

minutes_traveled = float(input())

#call the function and print the output

print('Miles: %f' % mph_and_minutes_to_miles(miles_per_hour, minutes_traveled))

Explanation:

Read the value of "miles_per_hour" and "minutes_traveled" from user. call the function mph_and_minutes_to_miles() with those two parameters.calculate total hours from the minutes_traveled by dividing it with 60. then calculate the total miles by multiply hours_traveled * miles_per_hour. then return the miles travelled.

Output:

20                                                                                                                        

150                                                                                                                        

Miles: 50.000000

You might be interested in
Any movie/show suggestions??
trasher [3.6K]
The office is a good one. If you haven’t ever watched it
6 0
3 years ago
Read 2 more answers
A user from the accounting department has contacted you regarding problems with a dot matrix printer. When you examine the outpu
Mama L [17]

Answer:

Replace the printhead is the correct answer.

Explanation:

Because in the following statement, that person is from the department of the accounting then, he call the technician regarding the problem occurs in the printer which is dot-matrix printer and when he examined the dot-matrix printer and replace the printhead because when he print any document then, he finds that some letters have missing from the page.

5 0
3 years ago
What is the best website to get a iphone
sveticcg [70]
Generally I'd recommend not buying one online, tends to be cheaper from a shop - and better used, although their are some risks with 2nd hand devices, I think the big price cut it worth it. 

If you did want to buy online, maybe Amazon or Ebay?
7 0
3 years ago
Read 2 more answers
When excel follows the order of operations the formula 8 * 3 + 2 equals?
Airida [17]
It follows the normal convention of BODMAS , which is the order of precedence of operations , so the answer equals to 26
3 0
3 years ago
What would you enter at the command prompt to start a new bourne again shell session?
butalik [34]

The answer is bash . The bash command opens a Bourne-again sheel (bash) session. It is the standard shell used in most Linux computers and it uses commands similar to a UNIX shell. Bash includes features such as:

1) Command completion when pressing the tab key.

2) Command history.

3) Improved arithmetic functions.

6 0
3 years ago
Other questions:
  • This activity will help you meet these educational goals:
    7·2 answers
  • When you are printing handouts, which of these can you do? A. Save paper by placing more than one slide per page. B. Check the f
    7·1 answer
  • Find some search engine as many that you can find
    9·1 answer
  • In c please
    7·1 answer
  • WHY DO YOU DElete EVERY QUESTIONS THAT IS ASKED! Im a freaking guy, yes and i wont followers for my channel so leave me alone!
    7·2 answers
  • Name:
    13·1 answer
  • A _____ is the viewing area for a web page, which is much smaller on a phone than on a traditional desktop.
    7·1 answer
  • Why do companies use online collaborative productivity software.
    15·1 answer
  • Complete the sentence about bias and equity.
    7·1 answer
  • Dion Training has hired you to assess its voucher fulfillment web application on its e-commerce website. The web application rel
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!