SharedClass Samples / calculate-drive-time.pyOpen in CoCalc
distance_to_travel = float(raw_input('How far are you going? '))
speed_limit = float(raw_input('What is the speed limit? '))
minutes_to_save = float(raw_input('How many minutes do you want to save? '))

numerator = (speed_limit * minutes_to_save * speed_limit) / (distance_to_travel * 60)
denominator = 1 - (speed_limit * minutes_to_save) / (distance_to_travel * 60)

new_speed = (numerator / denominator) + speed_limit

print 'You should go', new_speed, 'to save', minutes_to_save, 'minutes over going', speed_limit,
print 'when traveling', distance_to_travel, 'miles'