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
What method parses its string argument to determine whether the string can be converted to a number?
den301095 [7]
The correct answer is: Tryparse method
6 0
3 years ago
Plz answer me will mark as brainliest​
ryzh [129]
Expansion Slot
ROM
Hope this helped
6 0
4 years ago
A(n) _____ program, used to participate in a newsgroup, is often provided with some e-mail software.
pogonyaev
Newsreader.

I hope it helps you.
8 0
3 years ago
Prove that A + ĀB = A + B using 1) boolean basic laws and 2) truth table​
Nostrana [21]

Answer:

projects of sums or POS Boolean expectation may also be generated from two tables quite easy divide determining which rows of the table have and output of zero writing on some term for each row and final multiplying all the some terms this creates a bowler expression representing the truth table as whole

Explanation:

helpful

6 0
2 years ago
একটি ডকুমেন্ট তৈরী করে ড্রাইভে সেভ করার পদ্ধতি বর্ণনা করো
kotykmax [81]

Answer:

To create a document, you have to go into Google Docs and make a new document, and then it automatically saves to Drive for you.

Explanation:

4 0
3 years ago
Other questions:
  • A corporation needs an operating system that allows the various teams in its office to network and collaborate on projects. Whic
    14·1 answer
  • Standards for all managers ethical responsibilities are covered in a company's
    7·2 answers
  • The create_python_script function creates a new python script in the current working directory, adds the line of comments to it
    9·1 answer
  • 5. The shell of a document that may be used over and over in desktop publishing is called a
    14·2 answers
  • The item that is clicked in a JList can be retrieved using the _____ method of JList.
    8·1 answer
  • Translate each statement into a logical expression. Then negate the expression by adding a negation operation to the beginning o
    15·1 answer
  • How do I add decimals in python?
    6·1 answer
  • What is single user operating system? Write two examples.​
    12·2 answers
  • Number are stored and transmitted inside a computer in the form of​
    6·1 answer
  • You have probably heard of wearable fitness devices, such as FitBit. What new products do you think might exist in this field in
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!