One-Liners

summary

solve small programming problems

time

20’

preparation time

10’

group size

all

material

screen

How it is done

Create 5 small programming problems that can each be solved by a single line. Provide participants with comments but no code:

# starter code
import seaborn as sns
df = sns.load_dataset('flights')

# 1. Check the number of rows and columns

# 2. Show all data for 1950

# 3. Calculate the average passenger number

# 4. Plot the 'passenger' column

# 5. Save the data to a new CSV file

Give students 5-10 minutes to work on the taks in pairs. Then go through the results together.

Comments

The tasks should be very easy for most students. This type of activity is a brain massage, not a test. The solutions give you a good impression what the group is comfortable with. If everyone succeeds in the first 10 minutes, they will make you succeed during the rest of the lesson.

This type of exercise goes together well with an online platform for interactive coding such as binder, gitpod or JupyterLite.