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 do we call notes in computer code for the programmer that are ignored by the compiler?.
Lelu [443]

The notes in computer code for the programmer that are ignored by the compiler is called a comment.

<h3>What are codes in programming?</h3>

Codes in programming are specific sequences or sets of instructions that are made for specific programs. They are written in a specific language. They are made to make a human-friendly language. Codes are made after the compiler confirms them.

Comments are written for the document. They tell what the document is for, and how the document is constructed.

Thus, the notes on the computer code for the programmer are called a comment.

To learn more about comments in computer code, refer to the link:

brainly.com/question/18340665

#SPJ4

4 0
1 year ago
Which of the following is a key feature of SmoothWall? Weak traffic graphs and bandwidth bars Universal Plug and Play support DM
MissTica

Answer

Universal Plug and Play support

Explanation

A smooth wall is used as an open source firewall. A fire wall is a system which is specifically designed to provide network security. It does so by making sure that only access which are authorized are allowed to a network. For instance there is untrusted traffic  on the network the firewall will stop it.

The key feature of smooth wall is Universal Plug and Play support which is a feature that allows devices on your network to discover each other access and certain services.

6 0
3 years ago
What year did polaroid introduce one-step photography with the SX-70
blagie [28]

Answer:

I first saw the Polaroid SX-70—the one-step instant camera introduced in 1972 by the company's co-founder, Dr.

Explanation:

5 0
2 years ago
How do new sources of power assist in the development of inventions?
pentagon [3]
<span>New sources of power assist in the development of inventions since t</span>he new inventions would have been worthless without a reliable source of power energy.
3 0
3 years ago
Footnotes and endnotes can be used to explain information in more detail, add opinions or comments, or to cite sources in the do
adell [148]
Well thats false. They are only notes, not extra details.
8 0
3 years ago
Other questions:
  • A computer’s memory is composed of 8K words of 32 bits each. How many bits are required for memory addressing if the smallest ad
    10·1 answer
  • In step 2 of the mail merge process you must be prepared to
    6·2 answers
  • Which of these BEST describes an inference?
    11·2 answers
  • Which of the following is NOT a fall prevention system?
    12·2 answers
  • In this section of your final project, you will write a basic script to create and back up files. You will create this script wi
    11·2 answers
  • How does Shakespeare immediately introduce Tybalt as a menacing character?
    9·1 answer
  • 8.5 Edhesive Code Practice
    14·1 answer
  • WHATS 5X750 i really dont even know that questiob
    7·2 answers
  • Complete the following sentence by choosing the best answer from the options listed below.
    11·2 answers
  • You want to add a caption to a table. which tab contains this option?.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!