CSc 7003, Programming for Data Science (Summer 2023)

Program 1 - Time Difference

Write a Python program that reads in two times, an earlier time and a later time, and prints the difference in time in minutes as well as in hours/minutes. The format of the time is HH:MMAM or H:MMAM or HH:MMPM or H:MMPM. Also the AM or PM may be in lower case. A sample run of the program is shown below:
Mac-mini:2310-problems-sp99 raj$ python3 Time.py 

Enter Earlier Time: 9:36aM
Enter Later   Time: 6:22PM
Number of minutes between   9:36AM and 6:22PM = 526
The time difference between 9:36AM and 6:22PM = 8 hours and 46 minutes.

Mac-mini:2310-problems-sp99 raj$ python3 Time.py 

Enter Earlier Time: 09:36AM
Enter Later   Time: 08:36AM
Earlier time is not earlier than later time!

Mac-mini:2310-problems-sp99 raj$
The formatting of the output should be exactly as shown above. This program should be placed in a file called Time.py.