Exercise 4#

Note

Please complete this exercise by the start of the next lesson.

Start your assignment

You can start working on your copy of Exercise 4 by accepting the GitHub Classroom assignment.

You can also take a look at the template repository for Exercise 4 on GitHub (does not require logging in). Note that you should not try to make changes to this copy of the exercise, but rather only to the copy available via GitHub Classroom.

Pair programming

Students attending the course in Helsinki, note that we continue working in pairs. We will only grade the repository of the member of your pair that is responsible for this week’s exercise. See more information in Slack, and in week 2: Why are we working in pairs?

Cloud computing environments#

https://img.shields.io/badge/launch-binder-red.svg https://img.shields.io/badge/launch-CSC%20Noppe-blue.svg

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:

my_list = ['car', 'bus', 'bike', 'car', 'car', 'bike']
car_count = my_list.count('car')
print("There are", car_count, "cars in my list!")