Practice Mode: Question --> tags:1012-2

I’m busy with this practice question and solved for it however when the correction machine checks it, it tells me that my solution results in NONE when inputting [0, 0]. When I create a variable with [0,0] the output is correct “00:00”. Can somebody help me see what is going wrong?

The problem:
Write a function named format_time with:
Arguments:
hour: An integer representing the hour
minute: An integer representing the minute
Output:
Your function should format the provided hour and minute into a string with five characters as described above

Test your function by printing the result on the provided inputs. For example, you can test it on the first input by executing print(format_time(hour_1, minute_1)).

Your function will also be checked by being executed on a set of hidden inputs

My solution:

def format_time(hour, minute):
            time1 = str(hour)
            time2 = str(minute)

    if len(time1) == 1:
        time1 ='0'+ time1
    if len(time2) == 1:
        time2 ='0' + time2
    else:
        time1, time2
    timeformat = print(time1 + ':' + time2)

hey @cquarton

Since you didn’t attach any links to the screen of the particular question, I am not entirely sure if this would help you.

just in case as a helper, you have printed the result in function rather than returning it.

The function needs to utilize a return statement. for the checker, your result is hence coming as None type.

thanks @Rucha for the explanation. Next time. I’ll make sure to attach a screen link.