Lesson 4: Road trip planner

posted Oct 29, 2019, 7:55 AM by Attila Lengyel
distance = 24901
mpg = 15
tanksize = 50
price = 3.80
speed = 20

totalgas = (2 * distance) / mpg
stops = totalgas/tanksize
cost = totalgas * price
totaltime = (2 * distance) / speed
totaltime = totaltime + stops * 0.3
totaltime = totaltime / 24

print("You will need to stop", stops, "times")
print("The gas will cost you", cost, "dollars")
print("It will take you", totaltime, "days")
Comments