id/email
password
forgot password
about | help | done | prefs | create account
CodingBat code practice

Python > Logic-1 > alarm_clock
prev  |  next  |  chance

Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a boolean indicating if we are on vacation, return a string of the form "7:00" indicating when the alarm clock should ring. Weekdays, the alarm should be "7:00" and on the weekend it should be "10:00". Unless we are on vacation -- then on weekdays it should be "10:00" and weekends it should be "off".

alarm_clock(1, False) → '7:00'
alarm_clock(5, False) → '7:00'
alarm_clock(0, False) → '10:00'

...Save, Compile, Run

See also Python Example Code. Python help docs: Python Strings | Python Lists | Python If Boolean


prev  |  next  |  chance   |  CodingBat  >  Logic-1

Forget It! -- delete my code for this problem 118.0

Copyright Nick Parlante 2006-10 - privacy