Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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.
print
return
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
format
return "{0:02}:{1:02}:{2:02}".format(hour, minute, second)
Add a comment
Required, but never shown
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.
Explore related questions
See similar questions with these tags.
printwithreturnand remove the brackets?