I keep getting a 'list index out of range error'

Let’s say I have this:

box_list = ['open']

Shouldn’t this work?:

second_word = box_list[1] if box_list[1] else None

In your example, your list only has one element. That element is at index 0 not 1. Also, you cannot check an element at an index that doesn’t exist. That’s why you have the error. I’m not sure what you’re trying to accomplish in the end, but this would accomplish the task at hand:

box_list = ['open']
try:
    second_word = box_list[1]
except IndexError:
    second_word = None