Aug-01-2020, 12:37 AM
I wanted to make converter from Miles to Km and have estimated driving time in my program . The problem is i cant not print exactly driving time .
if i use //, instead of /. This forces Python to do an integer division (i.e. ignore decimal points) since we ignore decimal points if input number less than 57 estimated time will be 0
for example if i enter input miles 280 result is "Estimated driving time 4.977777777777778 hours" i wanted to make something like 4hours 59mins in this case
if i use //, instead of /. This forces Python to do an integer division (i.e. ignore decimal points) since we ignore decimal points if input number less than 57 estimated time will be 0
for example if i enter input miles 280 result is "Estimated driving time 4.977777777777778 hours" i wanted to make something like 4hours 59mins in this case
distanceMiles = input("Miles ? ")
distanceKM = int(distanceMiles) * 1.6
meters = int(distanceKM) * 1000
centimeter = int(meters) *100
drive = distanceKM/90 #speed per hour
print(" in kilometers is", distanceKM, "km")
print(meters, "meters")
print(centimeter, "cm")
print("Estimated driving time",drive, "hours")
