''' Purpose: gain experience with if-elif-else ''' # report message based on day of week # Sunday: weekend day # Monday: start of school week # Tuesday: school day # Wednesday: school day # Thursday: school day # Friday: end of school week # Saturday: weekend day # get day of interest reply = input( 'Enter day of week: ' ) # put day in standard format - first letter capitalized, others lower case day = reply.strip() day = day.capitalize() # day = reply.strip().capitalize() # alternatively could also be written as # be careful with this - strip() returns a string, and we pass that into the capitalize() function, which accepts a string print( ) # analyze and report on day # we could check each day of the week individually, but that's a lot of lines repeating the same message if ( day == "Monday" ) : # **our if statement starts here** print( "start of school week" ) elif ( day == "Friday" ) : # elif says we're still in the same if statement -> only 1 action is executed print( "end of school week" ) # elif ( day == "Tuesday" or day == "Wednesday" or day == "Thursday" ) : nothing wrong with this it's just long elif ( day in [ "Tuesday", "Wednesday", "Thursday" ] ) : # this is equivalent to the line above # why do we use a list instead of a string? we're checking for a string, not a character # we could define a list called school_days and assign it to this list, but checking print( "school day" ) elif ( day in [ "Saturday", "Sunday" ] ) : print( "weekend day" ) else : print( "that's not a day of the week!" ) # the if statement is over now. since there was an else, we executed exactly one of the actions above