Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In python Write the function inAWhile that takes two integers t and d, where t i

ID: 3745327 • Letter: I

Question

In python

Write the function inAWhile that takes two integers t and d, where t is the present time on a 12-hour clock, rounded to an integer (so t is an integer in the interval [1,12]) and h is an integer increment in hours, and returns the time on a 12-hour clock in h hours. Notice that 12 is followed by 1 on a 12-hour clock, since only computer scientists start counting at 0. The test data will clarify. Additionally, you should guarantee that the type of the parameters is int, using an assertion.

Explanation / Answer

def inAWhile(t, d): h = (t + d) % 12 if h == 0: return 12 else: return h print(inAWhile(3, 6)) print(inAWhile(6, 8)) print(inAWhile(3, 9))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote