-
Notifications
You must be signed in to change notification settings - Fork 1
Python Warmup 1 sleep_in
Ryan M edited this page Mar 5, 2016
·
2 revisions
#Python > Warmup-1 > sleep_in
Result: Incorrect Error message: Error:sleep_in() takes exactly 2 arguments (0 given) Reference: CodingBat Python Example Code
##Solution:
def sleep_in(weekday, vacation):
if not weekday or vacation:
return True
else:
return False
# This can be shortened to: return(not weekday or vacation)
##Ryan's attempt:
global weekday, vacation
def isWeekday():
weekday = True
return weekday
def isVacation():
vacation = True
return vacation
def sleep_in(weekday, vacation):
if sleep_in(False, False): return True
if sleep_in(True, False): return False
if sleep_in(False, True): return True
def main():
isWeekday()
isVacation()
sleep_in()
main()