repl.it
Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
# TODO: create a function that will calculate miles per gallon: miles / gallons
def mpg(miles, gallons):
    return(miles / gallons)

# TODO: ask the user how many miles they have driven
miles = int (input ("How many miles have you driven?"))
                   
# TODO: ask the user how many gallons they have used
gallons = int (input("how many gallons have you used?"))
               
# Call the function above with the user's input and print the result
print("Your car gets ", mpg(miles, gallons), " gallons per mile.")
Fetching token
?