time - Subtracting "variable[#]" with two digits in python? -
i'm building script in python calculate amount of time in between hours entered user lets example did following
time = input("enter times:") and user entered 3,11 show start time three, , end time 11. therefore, time equal 3,11. want able subtract show there 8 hour difference
i tried using
timesub= (int(time[3])-int(time[1])) but gives me -2 because time[3] equal 1. how make use 11 instead of 1?
time_input = raw_input("enter times:") time_parts = time.split(',') time_diff = int(time_parts[1]) - int(time_parts[0])
Comments
Post a Comment