import time # Set some vars number_of_commuters = 1000 number_of_visible_steps = 20 steps_between_walkers = 2 complete_escalator_seconds = 60 total_time = 0 count = 0 print str(number_of_commuters) + " commuters walking and standing:" while (count < (number_of_commuters/2)): # Standing Commuters get on number_of_commuters = number_of_commuters - number_of_visible_steps total_time = total_time + complete_escalator_seconds count = count + 1 count = 0 while (count < (number_of_commuters/2)): # Walking commuters number_of_commuters = number_of_commuters - (number_of_visible_steps / steps_between_walkers) total_time = total_time + (complete_escalator_seconds/2) count = count + 1 m, s = divmod(total_time, 60) h, m = divmod(m, 60) time = "%d hours %02d minutes and %02d seconds" % (h, m, s) print "It took " + time + " \n" # ====================== total_time = 0 count = 0 number_of_commuters = 1000 print str(number_of_commuters) + " commuters standing:" while (count < number_of_commuters): # Standing Commuters get on number_of_commuters = number_of_commuters - (number_of_visible_steps * 2) total_time = total_time + complete_escalator_seconds count = count + 1 m, s = divmod(total_time, 60) h, m = divmod(m, 60) time = "%d hours %02d minutes and %02d seconds" % (h, m, s) print "It took " + time + " \n"