Overview
This week we will complete Chapter 4 - Names for Strings and begin Chapter 5 - Names for Turtles.
Thursday, October 6th
Today we will make sure you have version of Python and the libraries you need to run the example programs from our text on your school laptop.
NOTE: The grade distribution for this week:
- A: 16
- B: 0
- C: 4
- D: 0
- E: 4
indicates that 16 of us completed both assignments on time, 4 of us completed 1 of the 2 assignments, and 4 of us did not submit either. I will make phone calls home tomorrow to those finding it challenging to complete assignments.
Classwork
Let's start with a few questions:
- How are procedures abstract in computer science?
- They are blocks of code that do something specific.
- They represent the lowest level of code for the computer to run.
- They use actual values to represent concepts.
- They can be used without understanding or seeing the code used.
- What do parameters used in a procedure provide?
- They allow software reuse for different values.
- They return calculated values from the procedure to the calling program.
- They provide a way to call a procedure from within another procedure.
- They provide the connection of an API to the procedure.
- You are writing a program to help the school assign lockers each year. You
have a list of student names and a separate list of locker numbers. The locker
numbers match the index position for the list. Assume the lists are correctly
initialized. What can replace
<missing code>
to assign the student to the next available locker?students ← [list of student names] lockerNum ← [list of locker numbers] index ← 1 FOR EACH name in students { <missing code> index ← index + 1 }
lockerNum ← name
lockerNum[index] ← name
students ← lockerNum
students[index] ← lockerNum
We will introduce the term API, and discuss how we use APIs in programming to hide implementation details in our programs. If time permits, we can take a look at student_lockers.py.
Homework
If you have not already done so, install Python 3.10 from the App Catalog. Then run:
% pip3.10 install pillow --user
Then read Chapter 5 - Names for Turtles up to the section Bob Builds a House, trying the examples and completing the code puzzles as you read.
Add a program named [your name]s_house.py
to your git repo
that has turtle with your name build a house with a chiminey and a door.
This assignment is due on Sunday at 1 pm.
Monday, October 3rd
We will begin class today by sharing what we found in the investigation we did for homework. After that, we'll begin learning about strings.
Classwork
Our goals for class today include:
- Briefly review Markdown and talk about how to use it in your git repos.
- Introduce APCSP Pseudocode and describe how you will use it in this course.
- Read through Chapter 4 - Names for Strings together in class, answering any questions you have about strings and the operations on them. I will also share some additional Python string features not presented in the text.
Homework
Create a directory named Chap04
in your git repository. Complete
each of the 22 exercises from
Chapter 4 Exercises in a separate file in this directory,
naming each file by its number, for example, the first one should be named
q01.py
.
Feel free to use the f-strings I showed you in class instead of the clunkier syntax used in the text.
This assignment is due on Wednesday at 1 pm.