In addition to the concepts below, you should also know the
concepts that were tested on all of the previous quizzes.
You should be able to define and explain the following terms:
- Sorting:
- Bubble sort, including the details of the algorithm and its worst-case
running time
- Selection sort, including the details of the algorithm and its worst-case running time
- Python dictionary
- Key-value pairs
You should understand and be able to use the following Python concepts:
- The string .split() method
- Dictionaries, including
- the empty dictionary
- adding a key-value pair to a dictionary
- accessing the value for a key in the dictionary
- dictionary methods like keys() and values()
- The in boolean operator for lists, strings, and dictionaries
- How lists and dictionaries are passed as function arguments
on the stack.
- You should also be able to write basic operations using lists, files,
and dictionaries, such as
- read and print all lines in a file
- read all lines in a file and store as a list
- print all key-value pairs in a dictionary
Practice problems:
- Multiple choice problem 6 on page 460 (Chapter 13)
- Discussion question 1 on page 462 (Chapter 13)
- Write a sort function (any sort) that takes in a list and sorts it.
Show what a call to your sort function would look like from main.
- Write a function that takes a value, k, and a list of values, and for
every occurrence of k in the list, the function should replace that list
item with k squared. Your function should also return the number of
times k appeared in the list. Show what a call to your function
would look like from main.
- Programming exercises 10 and 15 from Chapter 4 (pgs. 120-121)
- Programming exercise 11 from Chapter 11 (page 380)
- Write a program that reads in the following data from a grades file
and stores the data in a python dictionary that allows a user to look
up each student's grade:
lisa:98
betsy:100
charlie:91
jeff:82
mandy:88
jon:86
andy:77
include("../style/footer.php"); ?>