6.11 Chapter Assessment
From Foundations of Python ProgrammingGNU FDL 1.3Original pagePython2 class periods7 exercises7 graded tests
6.11 Chapter Assessment
Read first in the book: 6.10 Exercises.
Check your understanding
Check your understanding: a multiple-choice question in the book.
Exercise 1
Write a program that extracts the last three items in the list sports and assigns it to the variable last. Make sure to write your code so that it works no matter how many items are in the list.
Open the
01folder and editmain.py. Run Tests checks it.
Exercise 2
Write code that combines the following variables so that the sentence "You are doing a great job, keep it up!" is assigned to the variable message. Do not edit the values assigned to by, az, io, or qy.
Open the
02folder and editmain.py. Run Tests checks it.
Check your understanding: a multiple-choice question in the book.
Check your understanding: a multiple-choice question in the book.
Check your understanding: a multiple-choice question in the book.
Check your understanding: a multiple-choice question in the book.
Check your understanding: a multiple-choice question in the book.
Exercise 3
Write code to determine how many 9's are in the list nums and assign that value to the variable how_many. Do not use a for loop to do this.
Open the
03folder and editmain.py. Run Tests checks it.
Exercise 4
Write code that uses slicing to get rid of the the second 8 so that here are only two 8's in the list bound to the variable nums.
Open the
04folder and editmain.py. Run Tests checks it.
Exercise 5
Assign the last element of lst to the variable end_elem. Do this so that it works no matter how long lst is.
Open the
05folder and editmain.py. Run Tests checks it.
Exercise 6
Assign the number of elements in lst to the variable num_lst.
Open the
06folder and editmain.py. Run Tests checks it.
Exercise 7
Create a variable called wrds and assign to it a list whose elements are the words in the string sent. Do not worry about punctuation.
Open the
07folder and editmain.py. Run Tests checks it.
For teachers
6.11 Chapter Assessment
Students read Foundations of Python Programming's “Chapter Assessment” in CS Room and work through its 7 Python coding exercises (7 graded).
- Time: 2 class periods
- Tests: 7 in 7 graded exercises, set up for you when you import the lesson
Reading first
Exercises
| Folder | Grading | Tests |
|---|---|---|
01 | Autograded | 1 |
02 | Autograded | 1 |
03 | Autograded | 1 |
04 | Autograded | 1 |
05 | Autograded | 1 |
06 | Autograded | 1 |
07 | Autograded | 1 |