Week 13: Exercises

1. Strict Type Checking

Enable strict type checking in Visual Studio Code by setting python.analysis.typeCheckingMode to "strict". Now revisit the Tic-Tac-Toe program from our previous lecture, including the Tkinter user interface code. Add type hints so that the program passes all type checks in strict mode.

2. Northern and Southern Cities

Write a program that reads city data from the file cities.csv mentioned in the lecture notes. The program should find the 5 northernmost and 5 southernmost cities with a population of at least 100,000. For each such city, write its name, latitude, and population to standard output.

3. Testing Tic-Tac-Toe

Revisit the model class for Tic-Tac-Toe that we saw in the previous lecture. Write a file tic_tac_test.py that contains a series of unit tests for the model class. Run the tests using pytest and ensure that they all pass.