import utils## this function will take any two times on the 24 hour clock## and tell you the difference between themdef sandman(x, y):## we start off by making x and y into strings## we also set variables for the two segments of the strings (hours and minutes) x = str(x) x1 = x[0] + x[1] x2 = x[2] + x[3] y = str(y) y1 = y[0] + y[1] y2 = y[2] + y[3]## this if is what happens if x is greater than y if int(x) > int(y):## another embedded if for if the minutes on the first time## are greater than on the second time if int(x2) > int(y2): f1 = int(x1) - int(y1) f2 = int(x2) - int(y2) print f1, "hours", f2, "minutes"## an elif for if the minutes on the second time are greater than## the minutes on the first time elif int(y2) > int(x2): f1 = (int(x1) - int(y1)) - 1 f2 = 60 - (int(y2) - int(x2))## these 2 variables above are to make sure it dosent display over 60 minutes print f1, "hours", f2, "minutes"## this last elif is if the minutes are equal elif int(x2) == int(y2): f1 = int(x1) - int(y1) print f1, "hours"## this if is for y greater than x elif int(y) > int(x):## these following ifs and elifs are the same as above but for y greater than x## readd the above comments for details if int(y2) > int(x2): f1 = int(y1) - int(x1) f2 = int(y2) - int(x2) print f1, "hours", f2, "minutes" elif int(x2) > int(y2): f1 = (int(y1) - int(x1)) - 1 f2 = 60 - (int(x2) - int(y2)) print f1, "hours", f2, "minutes" elif int(y2) == int(x2): f1 = int(y1) - int(x1) print f1, "hours"## and at last if the user enters two times which are equivalent to eachother else: print "These times are equal."x = utils.get_time('Please enter the first time value:\n', 'Please read the instruction more carefully and try again.')y = utils.get_time('Please enter the second time value:\n', 'Please read the instruction more carefully and try again.')sandman(x, y)