Exercise 2 solution from datetime import datetime start = datetime(2026, 11, 2, 9, 15) end = datetime(2026, 11, 2, 17, 50) worked = end - start print(worked) # 8:35:00 print(worked.total_seconds() / 3600) # 8.583333333333334 hours, rest = divmod(int(worked.total_seconds()), 3600) print(hours, rest // 60) # 8 35 (All lines were run and printed exactly the values shown.) Explanation: subtracting two datetimes gives a timedelta. Printing it shows hours:minutes:seconds. total_seconds() turns it into one number you can do arithmetic on. Do not use the .seconds attribute for this: it holds only the seconds part left over after whole days are removed, so it is wrong for any span of a day or more. divmod splits the total into whole hours and a remainder in seconds.