CodePudding user response:
Def timeDifference (time1, time2) :
Time1hour=int (time1 [: 2])
Time1min=int (time1 [2:])
Time2hour=int (time2 [: 2])
Time2min=int (time2 [2:])
If time1hour - time2hour & lt; 0:
Print (" input is wrong!" )
The else:
If time1hour==time2hour and time1min & lt; Time2min:
Print (" input is wrong!" )
The else:
If time1min & lt; Time2min:
Time1min +=60
Time1hour -=1
Timediff=STR (time1hour time2hour) + STR (time1min - time2min)
If time1hour - time2hour & lt; 10:
If time1min - time2min & lt; 10:
Timediff="0" + STR (time1hour - time2hour) + "0" + STR (
Time1min - time2min)
The else:
Timediff="0" + STR (time1hour - time2hour) + STR (
Time1min - time2min)
The else:
If time1min - time2min & lt; 10:
Timediff=STR (time1hour time2hour) + "0" + STR (
Time1min - time2min)
Print (timediff)
TimeDifference (" 1145 ", "0900")
CodePudding user response:
Well, thank you very much for the answer, there is a problem, I according to your source input, why would an errorCodePudding user response:
To import into a library, written in front of theimport datetime
CodePudding user response: