r/dailyprogrammer • u/jnazario 2 0 • Mar 02 '18
Weekly #28 - Mini Challenges
So this week, let's do some mini challenges. Too small for an easy but great for a mini challenge. Here is your chance to post some good warm up mini challenges. How it works. Start a new main thread in here.
if you post a challenge, here's a template we've used before from /u/lengau for anyone wanting to post challenges (you can copy/paste this text rather than having to get the source):
**[CHALLENGE NAME]** - [CHALLENGE DESCRIPTION]
**Given:** [INPUT DESCRIPTION]
**Output:** [EXPECTED OUTPUT DESCRIPTION]
**Special:** [ANY POSSIBLE SPECIAL INSTRUCTIONS]
**Challenge input:** [SAMPLE INPUT]
If you want to solve a mini challenge you reply in that thread. Simple. Keep checking back all week as people will keep posting challenges and solve the ones you want.
Please check other mini challenges before posting one to avoid duplications (within reason).
View all comments
Show parent comment
1
u/zatoichi49 Mar 09 '18 edited Mar 13 '18
Espeak
Method:
Set postfix variable (z) to "a.m.", and let (x, y) be (hours, minutes). If x > 12, subtract 12 to convert to 12-hr and change z to "p.m.". If y < 10, prefix y with "oh". Change any zero values (x(0) = 12 and y(0) = "o'clock") and return x, y, z.
Python 3:
Output: