Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 1 : Alarm Clock Write a function named alarm _ clock. The function has two parameters. The first parameter is an integer named day

Exercise 1: Alarm Clock
Write a function named alarm_clock. The function has two parameters. The first parameter is an
integer named day that encodes the day of the week: 0=Sun, 1=Mon, 2=Tue, ...,6=Sat. The second
parameter is a boolean named vacation, and it is true when we are on vacation. The function returns
a string that indicates when the alarm will ring. On weekdays (non-vacations), the alarm should ring at
7 a.m., i.e., the function should return "07:00". On weekends (non-vacations) and vacations (weekdays),
the alarm should ring at 10 a.m. On vacation weekends, the alarm should be off, i.e., the function should
return "off".
Use the Python shell to test alarm_clock.

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

What is the purpose of a check digit?

Answered: 1 week ago