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
Ket [755]
2 years ago
11

Write a program to display MPH (Miles per Hour). Create a function to calculate the MPH. Ask the user for the number of miles dr

iven and the number of minute it took to drive that many miles. Validate that both the number of miles and the number of minutes is a positive, non-zero number. Pass both the number of miles and the number of minutes to the function, and have the function return the MPH.
Computers and Technology
1 answer:
puteri [66]2 years ago
7 0

Answer:

In Python:

def MPH(miles,minutes):

   mph = round(60 * miles/minutes,1)

   return mph

   

miles = float(input("Miles: "))

minutes = float(input("Minutes: "))

if miles>0 and minutes>0:

   print("MPH: ",MPH(miles,minutes))

else:

   print("Positive inputs only")

Explanation:

This defines the function

def MPH(miles,minutes):

This calculates mph rounded to 1 decimal place

   mph = round(60 * miles/minutes,1)

This returns the calculated mph

   return mph

The main begins here

This gets input for miles    

miles = float(input("Miles: "))

This gets input for minutes

minutes = float(input("Minutes: "))

If miles and minutes are positive

if miles>0 and minutes>0:

This calls the MPH function

   print("MPH: ",MPH(miles,minutes))

If otherwise, this prompts the user for positive inputs

<em>else:</em>

<em>    print("Positive inputs only")</em>

You might be interested in
POINT AND BRAINLIEIST GIVE AWAY!!!
Sonbull [250]

Answer:

Hey whats up

Explanation:

Count me in chief! I love when fellow user give out mighty points

7 0
3 years ago
Read 2 more answers
Sending a busy manager a long email represents a problem in which area of the communication process
FromTheMoon [43]
Time management,they wouldn’t have enough time to read it and they would become more stressed out
3 0
3 years ago
What is word processors​
otez555 [7]

A word processor is a computer program or device that provides for input, editing, formatting and output of text, often with additional features.

8 0
2 years ago
Describe what each of the following functions in R do.1. t2. matplot3. c4. seq5. legend6. matrix7. rownames8. colnames9. type of
slega [8]

Answer:

1. t is a function used to transpose a matrix object. The object is passed as an argument to the function.

2. matplot is a graphical function in R used for data visualization.

3. The c function is used to combine arguments.

4. seq is an R function used to derive a range of numbers, optionally specifying a start, stop and step argument or simply a single numeric argument.

5. legends are used in data visualization to list and define items in the graphical presentation.

6. matrix is a function in R used to create and work with matrix and data frame objects.

7. rownames and colnames are functions used to label the row and columns of a data frame in R.

8. The typeof function return the data type of an object.

Explanation:

The R programming language is a dedicated programming language for data analysis and visualization.

5 0
3 years ago
The carbon fixation reaction converts?​
Ainat [17]

Answer:

Photosynthetic carbon fixation converts light energy into chemical energy. Photosynthesis reduces the carbon in carbon dioxide from OSC = +4 to OSC = +1 in the terminal carbon in glyceraldehyde-3-phosphate, the feedstock for simple sugars, amino acids, and lipids.

3 0
3 years ago
Other questions:
  • PLEASE HURRY What data unit is addressed based on the IP address of the recipient? a. packet b. frame c. segment d. section
    9·2 answers
  • You are a project manager tasked to implement a critical application in a reputed bank. A client review indicates that you could
    11·2 answers
  • Which of the following, (1) money deposited in a bank account, (2) student recording her answer to a question in an online test,
    9·1 answer
  • Which two statements are true about the Data Sync functionality? (Choose two.)
    15·1 answer
  • A character with the point size of 10 is about 10/72 of once inch in height
    8·1 answer
  • Write a paragraph explaining why you think its important to use ethics in computers
    9·1 answer
  • Find the median and mean of the data set below: 29 17 40 12 29
    6·1 answer
  • Tysm for Ace! :O<br> Hurray!
    10·2 answers
  • What are source data entry devices​
    13·1 answer
  • (True or False) The speed at which data travels on a bus is referred to as the word size.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!