0

I want to return in this format => "HH:MM:SS" (in a clock format and the HH, MM, SS change depend on the question) I know how to print it but I don't know how to return it.

4
  • 4
    Please show your code, what result you expect, and what result you're getting. Commented Oct 6, 2021 at 21:13
  • 1
    replace the word print with return and remove the brackets? Commented Oct 6, 2021 at 21:15
  • 1
    @Sayse You don't even need to remove the brackets :) Commented Oct 6, 2021 at 21:15
  • @Barmar - You dont, but you should :) Commented Oct 6, 2021 at 21:17

1 Answer 1

2

As you can do

print(f"{hour:02}:{minute:02}:{second:02}")

You can

return f"{hour:02}:{minute:02}:{second:02}"

If you prefer to use format it would be

return "{0:02}:{1:02}:{2:02}".format(hour, minute, second)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.