Convert Clock Format
Schedules and logs are often easier to read in 24-hour time, because there is no confusion between morning and evening hours. The function time_conversion receives a string s in the format hh:mm:ssAM or hh:mm:ssPM. Return the same time in HH:MM:SS format, handling the special cases: 12AM becomes 00, and 12PM stays 12.
Примеры
Ввод
"07:05:45PM"Вывод
"19:05:45"Ввод
"12:00:00AM"Вывод
"00:00:00"Ввод
"12:00:00PM"Вывод
"12:00:00"Нужно реализовать
def time_conversion(s: str) -> str:
Теги
strings
Zaloguj się, aby zobaczyć historię rozwiązań
Zaloguj sięZaloguj się, aby korzystać z Mentora AI
Zaloguj sięTests12
Visible tests
Ukryty test 7
Ukryty test 8
Ukryty test 9
Ukryty test 10
Ukryty test 11
Ukryty test 12
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid