ZakariaMoha / Toy-problems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coding Challenges Solutions

This repository contains Python solutions to three coding challenges. Challenges Challenge 1: Converting 12-hour time to 24-hour time Description:

The task involves converting a 12-hour time format (e.g., "8:30 am" or "8:30 pm") to a 24-hour format (e.g., "0830" or "2030"). Solution:

The convert_to_24_hour function takes an hour (in the range of 1 to 12), a minute (in the range of 0 to 59), and a period ("am" or "pm") as input and returns a four-digit string representing the time in 24-hour format. Challenge 2: Two numbers are positive Description:

This challenge requires determining if exactly two out of three integers are positive numbers. Solution:

The two_positive function takes three integers (a, b, and c) as arguments and returns True if exactly two of the three integers are positive; otherwise, it returns False. Challenge 3: Consonant value Description:

The task involves finding the highest value of consonant substrings in a given lowercase string, where consonants are any letters except "aeiou". Solution:

The solve function takes a string containing only lowercase alphabetic characters and calculates the highest value among the consonant substrings based on assigned values for each letter.

The Python solutions for these challenges are available in the corresponding files: challenge_1_solution.py, challenge_2_solution.py, and challenge_3_solution.py.

Feel free to explore the code and use these solutions as needed!

This README provides an overview of the challenges and their solutions. For more details, refer to the individual Python files in this repository.

If you have any questions, suggestions, or improvements, feel free to open an issue or submit a pull request.

Happy coding! 😊🚀

About


Languages

Language:Python 100.0%