Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
List basics
Lists with if statements and loops
15. Lists with ifs and loops – practice 1
Lists in functions


Very good! Let's do some more exercises.


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