- Level
- Undergraduate (lower division)
- Prerequisites
- An introductory programming course, such as INFO 1201, CSCI 1300 or 1310, or ATLS 1710
- Length
- 15 weeks, three 50-minute lectures and one 50-minute lab a week
- Tools
- Python 3, Jupyter, numpy, pandas, networkx
- Textbook
- Problem Solving with Algorithms and Data Structures Using Python (open, online)
- Taught
- 2 terms, Spring 2017 and Spring 2018
- License
- CC BY-NC-SA 4.0
Overview
Computational Reasoning 2 is a survey of the ways to represent data in code and to express the relationships among data. Students start by comparing Python’s built-in data structures. Then they use Python libraries to work with text, tables, and networks, and they finish with two weeks of machine learning. Every in-class example and lab assignment is a Jupyter notebook in Python 3. The last week covers strategies for technical coding interviews.
I taught the course in Spring 2017 and Spring 2018. It is for undergraduates who have finished an introductory programming course, such as INFO 1201, CSCI 1300 or 1310, or ATLS 1710, and who already know loops, conditions, and functions; the first two weeks review these and introduce classes. There are no exams and no final project. Students do a lab assignment and take a short quiz every week.
Learning objectives
- Explain and apply the differences between the data structures in Python.
- Manipulate and analyze textual, tabular, and relational data with computational methods.
- Communicate findings with code and documentation in Jupyter notebooks.
Topics
Every week runs the same way. The first lecture introduces a new concept, and the second puts it to work with applications and debugging. The lab section introduces the week’s lab assignment. The third lecture opens with a quiz and then goes back over the hard parts of the concept and the lab.
| Week | Module | Topic |
|---|---|---|
| 1 | Introduction | Overview: setting up the computing environment; review of loops, conditions, and functions |
| 2 | Introduction | Objects: classes, namespaces, inheritance, methods, and attributes |
| 3 | Structures | Primitives: lists, tuples, sets, and dictionaries |
| 4 | Structures | Arrays: arrays and matrices in numpy |
| 5 | Strings | Introduction: string manipulation, encoding, and formatting |
| 6 | Strings | Applications: text pre-processing and regular expressions |
| 7 | Tables | Introduction: reading and manipulating tabular data in pandas |
| 8 | Tables | Reshaping: pivoting, stacking and unstacking, apply and map methods, and temporal data |
| 9 | Tables | Strings and missing data: string operations in tables; handling missing data |
| 10 | Tables | Grouping and joining: grouping and aggregating repeated values; joining tables on common keys |
| 11 | Graphs | Introduction: relational data in networkx; types of graphs and connectivity |
| 12 | Graphs | Applications: writing algorithms for network properties (search, shortest paths, and clustering) |
| 13 | Machine learning | Regression and classification |
| 14 | Machine learning | Dimensionality reduction and clustering |
| 15 | Interviewing | Preparation: problem solving and whiteboarding for the technical coding interview |
Readings
The main reading is Miller and Ranum’s open textbook Problem Solving with Algorithms and Data Structures Using Python on Runestone Academy. It is free to read online and has interactive code examples.
For further study, these resources are open:
- Pilgrim, Dive Into Python 3, 2nd edition (2009)
- Roughgarden, online courses on algorithms, with lecture videos
- Kane et al., Algorithmic Toolbox (online course)
- Nakhleh, Rixner, and Warren, Algorithmic Thinking, Part 1 (online course)
Assignments and assessment
| Assignment | Share of grade |
|---|---|
| Lab assignments | 45% |
| Weekly quizzes | 40% |
| Participation | 15% |
Lab assignments are due every week, 15 in all at 3% each. In each lab, students write Python code in a Jupyter notebook to understand the trade-offs between data structures and algorithms. Labs are graded on completeness, documentation, and clarity as well as correctness, and the instructor can ask a student to explain their code in a one-on-one code review.
Weekly quizzes take 15 minutes at the start of the last lecture each week and cover the concepts from the two earlier lectures. They show students and the instructor quickly which material is difficult. Only the 12 highest quiz scores count, so a student can miss three quizzes.
Participation is attendance and engagement in the three lectures and the lab section each week, at 1% a week. Engagement counts for more than attendance alone.
Adopt this course
Students use the Anaconda distribution of Python 3 with Jupyter, plus numpy, pandas, and networkx. Plan time in the first week to install the software on each student’s computer.
There are no public notebooks for this course, so an instructor must write new lecture notebooks and lab assignments.
The topics fit a 16-week semester with one week for a break. The Tables module runs four weeks. In a shorter term, I would combine weeks 8 and 9 or drop the Interviewing week. To add recursion and algorithmic complexity, take the Recursion and Complexity weeks from the Spring 2017 design.
The textbook has its own terms on Runestone Academy; the material on this page is under CC BY-NC-SA 4.0.
Past offerings
The first design followed a computer science sequence (fundamentals, data structures, classic algorithms, and SQL databases), with labs from Kubica’s Computational Fairy Tales and The CS Detective. In Spring 2018 I moved the course to Python libraries for text, tables, and networks, followed by an introduction to machine learning.
| Term | Design | Materials |
|---|---|---|
| Spring 2017 | Four modules: Fundamentals (recursion, complexity), Structures (linked lists, hashes, trees), Algorithms (sorting, graphs), and Databases (pandas, SQL); peer grading of labs | — |
| Spring 2018 | The design on this page | — |
Course materials on this page are licensed under CC BY-NC-SA 4.0: reuse and adapt them with credit, not for commercial use, and share adaptations under the same license. Last reviewed October 8, 2026.