Question: PYTHON Write a program that includes the function getTimeName(hours, minutes) that returns the English name for a point in time, such as ten minutes past

PYTHON Write a program that includes the function getTimeName(hours, minutes) that returns the English name for a point in time, such as "ten minutes past two", "half past three" "a quarter to four" or "five o'clock." Assume that hours is between 1 and 12.

Required Considerations:

  • test if the time is "special" and name it accordingly:
    • x:00 is "o'clock"
    • x:15 is "quarter after"
    • x:30 is "half past"
    • x:45 is "quarter til"
  • if the minute is 40 or less, it's "after"
    • x:40 is "forty past x"
    • x:22 is "twenty two past x"
  • if the minute is 41 - 59, it's "before"
    • x:49 is "11 until..." (you figure this part out)
    • x:42 is "18 until..." (you figure this part out)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!