mercredi 6 février 2019

Why doesn't Python read my boolean Vacation?

Here is my script below:

def alarm_clock(day, vacation):
  vacation_weekday = vacation and day in range(1,6)
  vacation_weekend = day == 0 and day == 6 and vacation

  if day in range(1,6):
     return  "7:00"
  elif day == 0 or day == 6:
     return  "10:00"
  elif vacation_weekday:
     return "10:00"
  elif vacation_weekend:
     return "off"    

If i run print(alarm_clock(1,True)) it returns 7 instead of 10:00. Can somebody help me ?

Aucun commentaire:

Enregistrer un commentaire