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
How do I mark someone brainiest
svet-max [94.6K]

Answer:

when someone answers your questio correctly, you will see a red crown. Click on that and mark them the most brainiest

Explanation:

3 0
2 years ago
Read 2 more answers
Can i have two e-mail accounts on my android
Scrat [10]
Yes, if you download an app such as gmail or yahoo mail. hope this answered your question.
5 0
3 years ago
A friend of yours started her own dog walking business. At first she only had a couple customers, and she used Word to create al
GaryK [48]
Hire more people to help type her documents, or make Batch invoices
4 0
3 years ago
Hillary’s family is thinking of relocating to a different city to save money. They set up a budget comparing the cost of living
vova2212 [387]

Answer: Oakland, and also a city they feel is the safest + best for there family

Explanation:

3 0
2 years ago
Please help guys I'm so lost ​
PilotLPTM [1.2K]

Answer:

The correct answer is C ( W * 5 )

4 0
3 years ago
Read 2 more answers
Other questions:
  • Suppose you with had two algorithms, A and B, with growth functions fa(n)=200n2 and fb(n)=2n4. If you were to do an exact analys
    13·1 answer
  • Briefly explain the cooling mechanism implemented in a fanless laptop
    15·1 answer
  • To name a computed field, follow the computation with the word ____ and then the name you wish to assign to the field
    8·1 answer
  • Security and protection as it relates to operating systems is grouped into four categories: Availability, Data integrity, Authen
    9·1 answer
  • A working model of a new product for testing purposes.
    15·1 answer
  • Which of these statements about the truck driving occupation in the U.S. are accurate?
    12·2 answers
  • Implement the function printTwoLargest that inputs an arbitrary number of positive numbers from the user. The input of numbers s
    14·1 answer
  • Coding 5 - Classes The Item class is defined for you. See the bottom of the file to see how we will run the code. Define a class
    13·1 answer
  • Consider a DataFrame named df with columns named P2010, P2011, P2012, P2013, 2014 and P2015 containing float values. We want to
    9·1 answer
  • How will technology help people with disabilities become more transportation independent?.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!