import time def frontEnd(): enter = (raw_input("Example: '22:00'\nInput current time: ")).split(':') enter[0], enter[1] = int(enter[0]), int(enter[1]) sleepTime(current = enter) def sleepTime(current = list(time.localtime()[3:5])): end = current[0] + 21 if end >= 24: end -= 24 while current[0] != end: out = str(current[0]) + ':' + str(current[1]) if current[0] <= 9: out = '0' + out if current[1] <= 9: out = out[0:3] + '0' + out[3:] print out current[1] += 90 while current[1] >= 60: current[0] += 1 current[1] -= 60 if current[0] >= 24: current[0] -= 24 sleepTime() print '\n\n\n\n' frontEnd() while raw_input('\n\n\n\n\n\nPress enter to quit...'): break ##print 'These calculations use the formula (hours awake / 2) - hours sleep = sleep debt' ##print 'It assumes a sleep debt of 0 on the first day.' ## ##print '2006-08-13 12:00-00:00 Awake' ##print '2006-08-14 00:00-03:00' ##print '2006-08-14 03:00-00:00 Awake' ##print '2006-08-15 00:00-06:00' ##print '2006-08-15 06:00-23:00 Awake' ##print '2006-08-16 23:00-03:30' ## ##print '\nFor this information, you would enter in 12, then 3, then 21, then 6, then 17, then 4.5' ##print 'That would be 12+21+17=50 for awake, and 3+6+4.5=13.5' ##print '50/2 = 25, 25-13.5 = 11.5' ##print 'The slept debt is 11 and a half hours.' #enter data, to add the hours of awake time ##print ' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24' ##print ' / / / / / / / / / / / / / / / / / / / / / / / /' ## #####get current_time #####get awake_time #####get wake_time #### ####current_time = 15#'20:42' # raw_input("Enter the current time (00:00): ") ####awake_time = 15#'19:00' # raw_input("Enter how long you've been awake (00:00): ") ####wake_time = 06#'06:00' # raw_input("Enter the time to wake (00:00): ") #### ####if wake_time - 8 < 0: #### wake_time = wake_time + 16 #### sleep_time = wake_time - overtime ####overtime = 0 ####if awake_time > 16: #### overtime = (awake_time - 16) / 2.0 #### ####print 'Go to sleep at:', sleep_time #### ###### ######if int(awake_time[:1]) > 16: ###### overtime = (awake_time[:1] - 16) / 2 ######if wake_time[:1] - 8 < 0: ###### wake_time = wake_time[:1] ###### sleep_time = wake_time - 8 - overtime ###### ######print sleep_time