12 and 24

Report a typo

Write a function format_time that takes a datetime object and formats its time component in a 24-hour format and a 12-hour format. The function doesn't return anything, instead, it should print the resulting strings, first the one with a 24-hour clock and then a 12-hour one. See the provided examples for the details of the format.

Note, however, that you do NOT need to call the function or process the input.

Sample Input 1:

20:05

Sample Output 1:

24h 20:05
12h 08:05

Sample Input 2:

12:07

Sample Output 2:

24h 12:07
12h 12:07

Sample Input 3:

23:59

Sample Output 3:

24h 23:59
12h 11:59
Write a program in Python 3
from datetime import datetime


def format_time(datetime_obj):
...
___

Create a free account to access the full topic