RUVIDEO
Поделитесь видео 🙏

How To Solve Time Conversion HackerRank Problem in Python

Problem: https://www.hackerrank.com/challenges/three-month-preparation-kit-time-conversion/problem?h_l=interview&isFullScreen=true&playlist_slugs%5B%5D%5B%5D=preparation-kits&playlist_slugs%5B%5D%5B%5D=three-month-preparation-kit&playlist_slugs%5B%5D%5B%5D=three-month-week-one
Solution: https://github.com/ashw24/Projects/blob/main/HackerRank%20-%20Python%20Projects/timeconversion.py

In this tutorial, we'll be solving the 'Time Conversion' problem on HackerRank using Python. The problem statement can be found here: https://www.hackerrank.com/challenges/time-conversion/problem

The problem is to convert a given 12-hour time string in the format hh:mm:ssAM or hh:mm:ssPM to 24-hour time format hh:mm:ss.

We have already provided a function timeConversion which accepts a string s as a parameter. The function starts by checking if the last two characters of the string are AM or PM. If it's AM, then the function checks if the first two characters are 12, if yes, then the function adds 00 to the new string. Otherwise, it just adds the first two characters to the new string. If it's PM, then the function checks if the first two characters are 12, if yes, then the function adds 12 to the new string. Otherwise, it adds the string representation of the integer obtained by adding 12 to the first two characters of the original string. Finally, it adds the remaining characters of the original string to the new string and returns it.

This code will take the input string in the format hh:mm:ssAM or hh:mm:ssPM from the user, then it will call the timeConversion function and pass the input string as its parameter. The function will convert the given 12-hour time string to 24-hour time format and return the result. The result will be written to a file.

And that's it! We've successfully solved the Time Conversion problem on HackerRank using Python. If you have any questions or want to see more examples, let me know in the comments."

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «How To Solve Time Conversion HackerRank Problem in Python», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.