#import string module import string #This function takes as input the string representatio of a day #and returns the int representation of the day def weekday(day): if day == "monday": return 1 elif day == "tuesday": return 2 elif day == "wednesday": return 3 elif day == "thursday": return 4 elif day == "friday": return 5 elif day == "saturday": return 6 elif day == "sunday": return 7 else: return 0 #ask the user for a day current_day = raw_input("Enter the day: ") #convert string entered by user to all lower case current_day_lower = string.lower(current_day) #call function to convert string representation of day to int representation #store result in weekdaynum weekdaynum = weekday(current_day_lower) #if user entered friday, print TGIF if weekdaynum == 5: print "TGIF!" #if user entered sat or sun, print weekend message elif 6 <= weekdaynum <= 7: print "It's the weekend!" #if user entered mon - thurs, print work message elif 1 <= weekdaynum <= 4: print "Back to work" #otherwise, print invalid input message else: print "Invalid day"