NPRG030 Programming 1 (winter 2025-6)

Instructors:

This course is a fast-paced introduction to programming and basic data structures, with a strong emphasis on learning to write working code. It assumes no previous programming experience. The course uses the Python programming language.

Throughout the course students will complete many programming exercises in Python, solving a wide variety of programming problems.

Lectures and other meetings

Requirements

This is a pass/fail course: you will not receive a numeric grade.

To pass this class, you must fulfill the following requirements by Friday, February 13, 2026 at the end of the exam period:

  1. Complete a number of programming exercises through the semester. The tutorial teachers will assign these exercises weekly, and you can submit your solutions to the ReCodEx automated grading system. To pass, you will need to earn at least 70% of the total possible points.

  2. Pass a written test at the end of the semester.

  1. Write a program in Python as a semester project. Your program should accomplish something that is interesting, cool, or fun and can be 100-300 lines long, or longer if you like. Here are some project ideas. Please send your tutorial teacher a 1-2 paragraph project proposal by Sunday, December 7. A first working version of your project is due by Sunday, January 18 and a final version by Sunday, January 25.

  2. Regularly attend the lectures and tutorials and participate in class.

You may not use ChatGPT, Copilot or other AI tools to generate code or documentation that you submit in any homework assignment or semester project in this course. Any use of such tools is considered cheating and may disqualify you from passing the class.

Textbooks

Resources

Syllabus

This is a rough map of the ground we plan to cover in this class. (It will probably evolve as the semester goes on.)

September 29 (notes) (exercises)
Introduction. Operating systems. The command line. Built-in types: integers, booleans, floats, strings. Numeric operators. Comparison operators. Boolean operators. Type conversions. Using an IDE. Variables. The input() and print() functions. Conditional statements: if and else. Elif. Comments. While loops. For loops. Ranges. The 'break' statement.
October 6 (notes) (exercises)
More about IDEs. Chained comparisons. More about ranges. The 'continue' statement. Math functions. Random numbers. ASCII and Unicode. chr() and ord(). String functions/operators. String indexing and slicing.
October 13 (notes) (exercises)
Functions vs. methods. String methods. Reading lines from standard input. Redirecting input and output. Processing newline characters. String formatting. Lists. List indexing and slicing. List operations.
October 20
Running time of list operations. Splitting and joining strings. Structural and reference equality. Nested lists. Tuples. Multiple assignment. Lists of tuples. None. Function definitions. Local and global variables. Variable numbers of arguments. Default parameter values. Keyword arguments. Basic plots with matplotlib.
October 27
Conditional expressions. File input/output. The 'with' statement. Command-line arguments. Sets. Dictionaries. Recursion.
November 3
Debugging. Objects and classes. Writing initializers with __init__. Writing methods. __repr__.
November 10
More on 'import'. Installing packages. Magic methods for operator overloading. Iterables and sequences. List comprehensions. Set and dictionary comprehensions.
November 17
No lecture (International Students Day)
November 24
Functions as values. map and filter. max() and sort() with key functions. Lambda expressions. Nested functions. The 'nonlocal' keyword.
December 1
Inheritance. Inheritance versus composition. Class objects. Class attributes, class methods. Testing an object's type. Raising and catching exceptions. Iterating with enumerate() and zip(). Dictionaries with defaults.
December 8
User interfaces with Tkinter. The Canvas widget. Event handling. Model-view architecture.
December 15
Type checking. Type hints. Dataclasses. Object-oriented design. The pygame library. Animation. Simple game physics.
December 22
No lecture (winter vacation)
December 29
No lecture (winter vacation)
January 5
Writing good code. Software testing. Unit, regression and integration tests. Code coverage. Comma-separated values.