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 best Describes algorithm bias
blagie [28]

Answer:

E

Explanation:

cause e

8 0
3 years ago
Add a clause for identifying the sibling relationship. The predicate on the left handside of the rule should be sibling(X, Y), s
jolli1 [7]

Answer:

following are the solution to this question:

Explanation:

For Siblings (X,Y);

Alice(X),

Edward(Y),

parent(Edward,Victoria,Albert) //Albert is the father F

parent(Alice,Victoria,Albert)  //Victoria is the Mother M

Therefore,

X is siblings of Y when;

X is the mother M and father is F, and  Y is the same mother and father as X does, and satisfing the given condition.

It can be written as the following prolog rule:

Siblings_of(X,Y):

parents(X,M,F)

parents(Y,M,F)

Siblings_of(X,Y): parents(X,M,F), parents(Y,M,F)

|? - sibling_of(alice,edward).

yes

|? - Sibling_of(alice,X).

X=Edward

|? - Sibling_of(alice,alice).

yes

5 0
3 years ago
What is the best way to prevent the most common cause of network failure?
Goryan [66]
Upgrade routers and servers annually.
8 0
3 years ago
Read 2 more answers
During Which model states that communication can occur simultaneously?
SVETLANKA909090 [29]

Answer:

i dont see any models...please include a picture

8 0
3 years ago
In which scenario would you view Word data in Excel?
s344n2d4d5 [400]

A. You want to analyze data from a table within a report, with functions and chats.

6 0
3 years ago
Other questions:
  • Jen wants to protect the schools network from hackers,worms,and viruses.she also wants to regulate access to certain websites th
    15·2 answers
  • Consider the following method:
    8·2 answers
  • Technician A says that automotive engine blocks are usually classified by the number of cylinders the block. Technician B says t
    9·1 answer
  • Yesterday you installed a new game on your computer. When you ran the computer, you noticed that the application was running ver
    15·1 answer
  • how can you create fades with the smart tool? How can you specify the types of fade curves that are used with the smart tool?
    13·1 answer
  • A contractor is preparing a bid to install swimming pools at a new housing addition. The estimated time to build the first pool
    12·1 answer
  • Which technology provides a solution to IPv4 address depletion by allowing multiple devices to share one public IP address
    13·1 answer
  • Investigar las oportunidades de empleo y el autoempleo dentro del área de la especialidad<br>​
    14·1 answer
  • Create a CourseException class that extends Exception and whose constructor receives a String that holds a college course’s depa
    8·1 answer
  • Describe how serial data access finds data
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!