Introduction
List basics
Lists with if statements and loops
15. Lists with ifs and loops – practice 1
Lists in functions
Summary

Instruction

Very good! Let's do some more exercises.

Exercise

We defined a list of some popular UK supermarkets in a variable called (surprise, surprise) supermarkets.

Write some code that will do the following: if 'Lidl' is not in the list, add it to the list.

Hint: the negation of if item in list is if item not in list.

Stuck? Here's a hint!

Use list.append(item) and:

if 'Lidl' not in supermarkets:
  # code here