Question
How would you use Python to figure out mph if you had written other code to put inputs of how many miles driven and how
How would you use Python to figure out mph if you had written other code to put inputs of how many miles driven and how many hours driven?
Below is what I have so far. When I try to do the calculation, it says there is an error on the string or float (that is not included). The last step is to write "You averaged [mph] on your trip" where the value in the brackets is the variable. It's supposed to give you the answer once the program prompts inputs when it is run but I get errors. How do I approach this?
# Part 1 - Average miles per hour on your trip miles = input("How many miles did you drive?") miles = float(miles) print("Miles driven:", miles)
#Prompt the user for hours driven hours = input("How many hours did you drive?") miles = float(hours) print("Hours driving:", hours)
"You averaged [mph] on your trip"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started