Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
List basics
Lists with if statements and loops
12. List length in if statements
Lists in functions


Good. We often check the number of list elements using the len(list_name) function in if statements:

# check if there are any elements
if len(companies) > 0:
  print('Some elements found')
  print('No elements found')


You are again given the tourist arrivals in France (they are available in the tourist_arrival variable in the Code Editor), but a friend of yours experimented with it a little bit. He might have deleted some entries from the list.

Write a piece of code that will check whether there are exactly 12 items in tourist_arrivals. If there are exactly 12 items, do nothing. Otherwise, print:

Incorrect number of months.

Stuck? Here's a hint!

To check if the number of months is wrong, use:

if len(tourist_arrivals) != 12