What about:
- using 10:00 as default:
- only check for weekend
- you might replace
(str(day) in weekend)
by(0 == str(day) %6)
but it is harder to understand
Code:
def alarm_clock(day, vacation):
weekend = "06"
if vacation and (str(day) in weekend):
return "off"
else:
if not (str(day) in weekend):
return "7:00"
return "10:00"
The bit more cryptic version:
def alarm_clock(day, vacation):
if vacation and 0 == day % 6:
return "off"
else:
if 0 != day % 6:
return "7:00"
return "10:00"