
Did You Know?
The 12-hour clock is a time convention in which the 24 hours of the day are divided into two periods: a.m. (from the Latin ante meridiem, meaning “before midday”) and p.m. (post meridiem, “after midday”). Each period consists of 12 hours numbered: 12 (acting as zero), 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, and 11. The 24 hour/day cycle starts at 12 midnight (often indicated as 12 a.m.), runs through 12 noon (often indicated as 12 p.m.), and continues to the midnight at the end of the day.

24-hour to 12-hour clock convertor
Your challenge consists of writing a computer program that asks the end-user to enter a time in the 24-hour format (e.g. 18:36). The program will convert this time in the 12-hour format (e.g. 6:36 PM).
To do so you can base your Python code on the following flowchart:

Python Code
Testing
Once your code is done, complete the following tests to check that your code is working as it should:
| Test # | Input Values | Expected Output | Actual Output |
| #1 | 06:30 | 6:30 am | |
| #2 | 14:25 | 2:25 pm | |
| #3 | 00:52 | 12:52 am | |
| #4 | 11:59 | 11:59 am | |
| #5 | 12:00 | 12:00 pm | |
| #6 | 23:59 | 11:59 pm |
Extension
Amend this code to validate the user entry and make sure they enter a time between 00:00 and 23:59 and to display a meaningful error message if not.

Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area





Two colors are considered complimentary (or opposite) if they produce a neutral color — black, white, or grey — when mixed evenly.

The purpose of this post is to demonstrate a basic example of how machine learning works.




Start by setting the starting node (A) as the current node.
Check all the nodes connected to A and update their “Shortest Distance from A” and set their “previous node” to “A”.
Set the current node (A) to “visited” and use the unvisited node with the smallest total distance as the current node (e.g. in this case: Node C).

Check all unvisited nodes connected to the current node (E) and add the distance from A to E to all distances from the connected nodes. Replace their values only if the new distance is lower than the previous one.
We found a path from A to Z, but is it the shortest one?

Start by setting the starting node (A) as the current node.
Check all the nodes connected to A and update their “Distance from A” and set their “previous node” to “A”.
Set the current node (A) to “visited” and use the closest unvisited node to A as the current node (e.g. in this case: Node C).
Check all unvisited nodes connected to the current node and add the distance from A to C to all distances from the connected nodes. Replace their values only if the new distance is lower than the previous one.
Set the current node C status to Visited.
B -> D 3+5 = 8 < 10 – Change Node D
D -> E 8+2 = 10 < 12 – Change Node E
E -> Z 10+5 = 15 > 14 – We do not change node Z.
We found the shortest path from A to Z.


