Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions