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]
3 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]3 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
What is the best free game designing program for windows
Nadusha1986 [10]
Python, Unity 3D, C++Notepad
8 0
3 years ago
Computer has brought radical change in every field​
tigry1 [53]

Answer:

Yes it has brought change in every field

Explanation:

3 0
3 years ago
How to delete account on this
qwelly [4]

Answer:

Explanation:

Go and edit your profile then go on prefernces you will see that its written delete my account and that's how you delete your account on brainly.com and if you want to delete you account on phone then

Open your phone's Settings app.

Tap Accounts. If you don't see "Accounts," tap Users & accounts.

Tap the account you want to remove Remove account.

If this is the only Google Account on the phone, you'll need to enter your phone's pattern, PIN, or password for security.

Hope this helped you!

5 0
3 years ago
Read 2 more answers
Introduction or background of corporal punishment in schools
tensa zangetsu [6.8K]

Answer:

Corporal punishment is a discipline method in which a supervising adult, such as a teacher, deliberately inflicts pain upon a child in response to a child's unacceptable behavior or inappropriate language. The goals of this type of punishment are usually to halt the offense immediately, prevent it from happening again, and set an example for others.

3 0
3 years ago
Identify the data link trailer blocker
IRINA_888 [86]
What are ur possible answers
7 0
3 years ago
Other questions:
  • Click to move a stacked object to the top of the stack?
    8·1 answer
  • If you have long column labels with columns so wide that they affect the readability of a worksheet you should first
    6·2 answers
  • An extranet is a restricted network that relies on Internet technologies to provide an Internet-like environment within the comp
    12·1 answer
  • Which of the following describe a required
    7·1 answer
  • Please debug the below code in Java please.
    15·1 answer
  • Who invented the speaker?
    14·2 answers
  • What factors do network consultants consider when determining the network needs of a business? Use the space provided below to a
    6·1 answer
  • To indent an entire paragraph or list you should:
    9·1 answer
  • List six features of the Microsoft ​
    10·1 answer
  • A(n) ________ attempts to slow down or stop a computer system or network by sending repetitive requests for information.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!