# A robot encounters a door. If the door is locked, the robot # should be instructed to turn around. If instead the door is # unlocked, the robot should be instructed to open the door and # enter the room. Note, before entering the robot should determine # whether the light is off. If it is off, the robot should be # instructed to first turn on the light. # Get status of the door reply = input( 'Door (locked / unlocked): ' ) # Put in standard format -- all lowercase door_sensor = reply.strip().lower() print() # Based on door sensor take action if ( door_sensor == 'locked' ) : # if the door is locked # Cannot enter -- the door is locked # must turn around print( 'turn around' ) # pass -- keyword - like a placeholder so your code doesn't blow up when you don't have code yet else : # if the door is not locked (unlocked) # We can go in # open the door print( 'open door' ) # Need to get status of light sensor - ask the user reply = input('Light on/off: ') # Put in standard format -- all lowercase light_sensor = reply.strip().lower() if ( light_sensor == 'off' ): # Can enter because the door is open and the light is on print( 'turn on the light' ) # if the light was off, we've turned on the light, and then we enter the room as well # if the light is on, we enter the room print( 'Enter the room' ) # we enter the room whether the light was already on, or it was off but then we # we turned it on in the if statement on line 36 # All done