thetime = 0 start = 11 stop = 1 stop2 = stop if (stop < start) : stop2 = stop + 24 if thetime <= stop : thetime = thetime + 24 if (thetime >= start) and (thetime <= stop2) : print 'true' else : print 'false'