Exercise 4 hints

Here are a few things that may be helpful in completing Exercise 4.

Importing variables from a script

In the lesson materials we saw how to import functions from a script.

In a similar manner you can also import any variable that has been defined in another script, hence, it is not limited to functions that you can import.

Counting values from a list

In some cases it might be useful to know how many times certain value exists in a list. Consider following example:

In [1]: my_list = ['car', 'bus', 'bike', 'car', 'car', 'bike']

In [2]: car_count = my_list.count('car')

In [3]: print("There are", car_count, "cars in my list!")
There are 3 cars in my list!