Untitled

mail@pastecode.io avatar
unknown
python
16 days ago
1.5 kB
2
Indexable
Never
exam_hour = int(input())
exam_minute = int(input())
arrival_hour = int(input())
arrival_minute = int(input())

difference = ((exam_hour * 60) + exam_minute) - ((arrival_hour * 60) + arrival_minute)

hours = 0
minutes = 0


if difference == 0:
    print('On time')

elif difference > 0:

    hours = difference // 60
    minutes = difference % 60

    if hours == 0:
        if minutes <= 30:
            print('On time')
            print(f"{minutes} minutes before the start")
        else:
            print('Early')
            print(f"{minutes} minutes before the start")
    else:
        print('Early')
        if minutes == 0:
            print(f"{hours}:00 hours before the start")
        elif minutes < 10:
            print(f"{hours}:0{minutes} hours before the start")
        else:
            print(f"{hours}:{minutes} hours before the start")

elif difference < 0:

    hours = abs(difference) // 60
    minutes = abs(difference) % 60

    if hours == 0:
        if minutes <= 30:
            print('Late')
            print(f"{minutes} minutes after the start")
        else:
            print('Late')
            print(f"{minutes} minutes after the start")
    else:
        print('Late')
        if minutes == 0:
            print(f"{hours}:00 hours after the start")
        elif minutes < 10:
            print(f"{hours}:0{minutes} hours after the start")
        else:
            print(f"{hours}:{minutes} hours after the start")
Leave a Comment