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]
3 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]3 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
Immigrants are allowed to enter the country to work when they have a(n)
Roman55 [17]

Answer:

D. a Visa

Explanation:

4 0
3 years ago
What type of computer is IBM 1401 ?<br><br>​
rjkz [21]

Answer:

The IBM 1401 is a variable-word length decimal computer that was announced by IBM on October 5, 1959.

7 0
2 years ago
When you enable user access control (uac)
SVEN [57.7K]
The UAC is on by default. So, you don't need to turn it on unless someone else turned it off.

The UAC has four modes.

The lowest mode is the off position. If the UAC is off, no UAC prompt will pop up when doing administrative tasks.

6 0
3 years ago
The first mechanical computer design in by Charles Babbage was Called​
White raven [17]

Answer:

<h2>Analytical Engine</h2>

Explanation:

Analytical Engine, generally considered the first computer, designed and partly built by the English inventor Charles Babbage in the 19th century (he worked on it until his death in 1871).

7 0
3 years ago
Read 2 more answers
The ip address 221.1.10.53 /24 is a what type of address?
jekas [21]
It is a class C address.  Class C covers all addresses in the range 192.0.0.0 to 223.0.0.0.  The /24 represents the number of network bits in the address so we can work out that the subnet mask of this address would be 255.255.255.0.
8 0
3 years ago
Other questions:
  • When you make a pointer variable im C++, is star label a must?
    9·1 answer
  • Which should you use to find a saved file?
    15·2 answers
  • What technique can improve web search results? Add articles, prepositions, and pronouns Be general rather than specific Focus on
    10·1 answer
  • Consider the following C++ program in which the statements are in the incorrect order. Rearrange the statements so that itprompt
    6·1 answer
  • Advantages and disadvantages of internet
    11·2 answers
  • A programmer has an idea to use just one language for the content, structure, and style of web pages. What might be a problem wi
    11·1 answer
  • 1. Trust can be built in a relationship if:
    15·1 answer
  • I need some help with this assignment. I'm having difficulty trying come up ideas to use here. Can I get any help?
    5·1 answer
  • What safety do you need to have ready to start a device repair?
    6·1 answer
  • If you want to change the name of a folder that stores Word documents, what should you do before changing the
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!