Groceries is being treated as a Tuple, instead of a List. Tuples can not be modified. So you need to use a list in this case. Write the list in square brackets as follows: groceries = ["rice", ....] I think python defaults something separated by commas as tuples, instead of list. Tho usually I thought parenthesis ( ) are used for tuples. But for lists, Brackets [ ] are always used in Python.