Detailed schedule and resources
Class 42
Exam review:
- Tracing loops: see loop-trace.py
Class 41
Exam review:
- Objects, methods, and constructors: see objects.py
Class 40
- The final exam is in two parts with one bathroom break between parts. See the sample exam cover sheet for additional details.
- Review of recursion: see recursion_review.py
Class 39
Practice question for stack diagrams
Class 38
- Exam review – go over written exam 2
- Advanced dictionary topic:
- dictionary of lists (last examinable topic)
Code:
Class 37
Please complete the course evaluation: https://dickinson.campuslabs.com/eval-home/
Demo:
Code:
Class 36
Code:
Class 35
Written exam 2.
Class 34
Exam review session.
Class 33
- Challenges and solution for objects, values, and references:
- Bring review questions for exam review next time.
Class 32
- Code for the reduce, map, and filter list processing patterns:
- Code and files for
joinandsplitstring methods: –>
Class 31
- Code for list basics:
Class 30
Please take this survey on how you get help for this course: https://forms.cloud.microsoft/r/P17NCHQ5ng
Code for CSV files:
Class 29
- Here is a link to the crosswords file mentioned in the textbook:
- https://www.gutenberg.org/files/3201/files/crosswd.txt
- We won’t use the crosswords file in class, but you can use it to understand the textbook properly and do the optional textbook exercises.
- Here is a file containing two poems that we will use in class:
- In class we will work on tasks such as:
- print the first line of the poems file
- print the first five lines of the poems file
- save every second line in a new file called
some-lines.txt - print the two lines that tell us the authors of the poems (they begin with “BY”)
- find the empty line separating the two poems and print its line number
- save the first poem in a new file called
first-poem.txt, and the second poem in a new file calledsecond-poem.txt
- Solutions to the first few tasks above are available:
Class 28
- Warmups for today: warmups.py
- More string method challenges:
Class 27
- Code for string methods:
Class 26
- Code for string indexing, slices, and iteration:
Class 25
- Code for practicing debugging:
Note: debug_practice_completed.py uses f-strings, also known as formatted string literals, for printing out the values of variables. This is an optional concept. See the Python documentation on Fancier Output Formatting for details.
Class 24
Announcements:
- happy 🌼 🌱 spring
- Eid Mubarak 😊
- feedback discussion
- hw6, qu9 – need
print('test_get_price succeeded')at the end of the test function - MUSIC LEAGUE!!!! – submit a weird song today
- Incentive: I will perform one of my music league submissions on ukulele if 10 or more people submit and vote this round.
Today’s class:
- In this class we examine two examples of interesting
algorithms:
- finding square roots using Newton’s method (scroll to “Use of Newton’s method to compute square roots” on that page)
- solving an equation using the bisection method.
- Note that detailed knowledge of these algorithms is not required for this course. These are just intended as interesting examples, to demonstrate the power of what we have already learned this semester. You are not required to memorize Newton’s method or the bisection method.
- Example code:
Class 23
- Code for demonstrating while loops:
Class 22
- Please complete the anonymous mid-semester survey.
- Code for demonstrating test functions:
Class 21
- Code for examples of recursion with return values:
Class 20
- Code for functions with return values:
- make_cheer.py
- (don’t look yet) make_cheer_completed.py
- code on toast for submitting your code snippets
Class 19
- overview of exam solutions (available on Moodle)
- Advising discussion for course selection. Please see the notes on course selection.
- Code introducing the idea of recursion: recursion_example.py
Class 18
Written exam 1
Class 17
Exam review – bring questions to discuss.
Class 16
Social/Ethical class III: Social good in computing. The article for discussion is available on the Readings web page.
- We need a volunteer note-taker for today.
- The class is divided into two separate discussions:
- Discussion of false dichotomies in computing, based on the assigned reading.
- Discussion of open-source software (OSS, FOSS, H/FOSS) based on in-class research done in pairs. Software projects to be discussed:
- Linux
- MySQL
- Apache HTTP Server
- OpenMRS
- OpenStreetMap
Class 15
Code for demonstrating guardians:
Class 14
Code for demonstrating and encapsulation and generalization:
Code for demonstrating factoring out repeated code:
Class 13
Social/Ethical discussion II.
- See Readings web page.
- You are expected read the assigned content carefully and take a few handwritten notes that you can bring to class and refer to during our device-free discussion.
- We need a volunteer note taker for today.
Class 12
Warmup: Draw the stack diagram for the program callstack_warmup.py in the following situations:
(a) Immediately before line 12 is executed
(b) Immediately before line 8 is executed
Announcement:
- The reading for Monday is available on the Readings page.
- For this type of discussion class, you are expected read the assigned content carefully and take a few handwritten notes that you can bring to class and refer to during our device-free discussion.
Topics for today’s class:
- Informal discussion of the scope of a variable: most variables and parameters are local.
- Review of call stack and debugging. Add the ability to step in, step over, step out.
- Printing on the same line from multiple
print()statements. - Mini-lab (ungraded):
- Using the callstack_demo.py program from last time, set a breakpoint in one of the functions. Practice running up to that point in the debugger and examining the local variables in each frame of the call stack. Now practice stepping statement by statement to the end of the program observing changes in the call stack and its local variables. Ask for help if you run into any problems.
Class 11
Demo code: debug_demo.py, callstack_demo.py
Class 10
Social/Ethical discussion I. See Readings web page.
- Notes provided by volunteer note taker (thank you Dylan!): comp130notes-2-9-2026.jpg – Also available on Moodle.
Class 9
Announcements about homework:
- Don’t comment out code when turning in solutions any more. We will encapsulate code in functions instead.
- For homework, make sure to write your code in IDLE and test it. When it’s working perfectly, then copy and paste it into your homework document.
- For homework, if using Microsoft Word, start with the assignment document. Then you can format the code by using the “code” style. If you get a lot of space between the lines, then use “Remove Space After Paragraph” (select text, maybe right click, look for line spacing option).
- Make sure your code is in a fixed width font like Consolas or Courier. (Why??)
Introductions: 2nd row, get ready
Today is mostly review of chained and nested conditional statements. We want to write a function decide(hungry, tired) that prints output according to
| hungry | not hungry | |
|---|---|---|
| tired | get takeout | sleep |
| not tired | cook dinner | watch Netflix |
Example code: (try to figure out for yourself first, don’t peek unless you need to) decide.py
Also Boolean variables and parameters – see SSG12.
Class 8
Today we cover chained conditional statements and nested conditional statements.
Solution to warmup exercise: warmup.py.
Additional example (Not covered in class): convert_miles2.py
We will also go over sections 9 to 11 of the supplementary study guide, which are needed for lab this week.
Complete example for using graphics.py with familiar coordinate system: graphics_example.py
Class 7
More introductions: front row, get ready with your first-year seminar topic and instructor and what you liked about the course.
Today we cover topics from the assigned textbook reading, including floor division and modulus, boolean expressions, relational operators (==, !=, >, >= etc.), logical operators (and, or, not), conditional execution (if, else).
Example Python code (but try to do the warmup exercise yourself before looking at this): convert_miles.py, boolean_demos.py
Class 6
Announcements:
- Please be aware of and make use of all the opportunities to get help in this course. See the main homepage “How do I get help in this course?” link.
- Homework solutions are available on Moodle.
- This is how to interpret graded homework assignments:
- First, remember that only a random subset of questions are graded. Second, usually some points are awarded for completeness (i.e. reasonable attempts at the questions that were not graded). The score written on your homework will look something like “14/14 + 10c = 24/24”. That means the graded questions were worth a total of 14 points and you scored 14/14. In addition, 10 points were awarded for completeness. Your total score was 24/24. So, the letter “c” in “10c” stands for “completeness”.
Today we cover Sections 4-8 of the supplementary study guide: nested for loops; range(); constructors; graphics.py; methods and dot notation.
Code: graphics_demo.py, grid.py; other code from today was copied directly from the study guide.
Class 5
Agenda for today’s class:
- In-class exercise to build familiarity with for loops:
- A. (warmup) Write code that prints out the result of rolling a 20-sided dice.
- B. Write code that prints out the results of rolling a 20-sided dice 100 times.
- C. Write code that computes and prints the average value of the rolls in the previous simulation (rolling a 20-sided dice 100 times).
- We’ll go over the supplementary study guide content about
forloops, which explains how to use the loop variable. - Run a basic turtle program.
Useful tip: Learn how to use IDLE’s Indent Region and Dedent Region features, in the Format menu.
Code (suggest don’t peek): roll_dice_once.py, roll_dice_100times.py, average_100_rolls.py, draw_square.py
Assignment statement explanation:

Class 4
Important note about the teaching style in this course: Many concepts will not be covered during our lecture session. It is essential to read the textbook carefully and ask questions on any content you don’t understand. For example, the assigned reading for Class 3 included the important concept of comments, but we did not discuss that during class.
Plan for today: We will go over some key concepts from the assigned reading, especially how to define new functions and how to generate random numbers.
Code: border.py, roll_dice.py
Class 3
If campus is closed on Monday, class will take place online via Zoom. The link and details are on the course home page.
- Make sure that you have Show File Extensions turned on in your
operating system. For example, you must be able to see the
.pyat the end of your Python files, when browsing folders. - When opening a Python file, do not just double-click on it in the folder view. First open the IDLE application, then use the Open command in the File menu.
Today we review the concepts in the assigned reading, including: variable names, keyword, import, dot operator, statement, expression, evaluation, execution, argument, comment, function definition, header, body, parameter
Example programs (suggestion: don’t peek before class): area.py, ask_question.py
Class 2
-
Answer questions on syllabus. Especially note the 5 exam dates.
-
Demo: AI can easily do your homework assignments. But it’s a really bad idea to rely on it, because you won’t have AI in the exams.
-
Interactive textbook: You can interact with the textbook by reading it in the form of Jupyter notebooks. Links to the notebooks are on the very first page of the textbook.
-
We will review concepts in the assigned reading, including some of the following: arithmetic operator, type (this is what I usually call a datatype), expression, function, function call, bugs and debugging, variable, assignment statement, state diagram,
input(). -
[If time allows.] Play with some more Python progams (see suggestions in class 1).
Class 1
Announcement: This class separates into two separate sections for labs: COMP130-01 on Fridays 3-5pm and COMP130-02 on Wednesdays 3-5pm. Currently there are significantly more students signed up for the Wednesday section. If you would like to switch to the Friday section (and thus receive more individualized help from the instructor and quantitative reasoning associate), please drop your current section and add yourself to the other section.
-
Please read the syllabus carefully and bring any questions to the next class.
-
Note the required reading: complete this before the next class.
-
Note when the first homework assignment is due.