Lecture 19 Slides - Quiz 2 Review

1 of 7

Quiz 2 Review

CS 110

1

2 of 7

Reminders and Announcements

  • P1 due FRIDAY (no extensions; no late submissions)
  • Quiz 2 is Wednesday - focuses on loops and conditionals
    • Students with Testing accommodations need to follow instructions in email
    • If you believe there is a mistake on any assignments submitted prior to Q2, the last possible moment to let me know of that is the beginning of Q2 (either in-person or via email).
    • There will be a Q2 Review/Q&A Session Monday 8:30pm - 9:30pm in TCH M164 (details on edSTEM)

This Week

  • Monday - Q2 Review + MQ 12
  • Wednesday - Q2
  • Friday - Dictionaries (P1 Due!)

3 of 7

Quiz 2 - Wednesday

  • In-person here in the Auditorium. (Students registered with ANU follow the instructions in your email)
  • Taken on the Lockdown Browser on your personal computer; details on how to set it up are on our Canvas page as well as on the Quiz 2 page.
  • If you have NOT tried the Lockdown Browser version of the Practice Quiz YOU WILL NOT RECEIVE EXTRA TIME IF YOU ARRIVE WITHOUT IT SETUP.
  • Problems are closer to our mini-quiz and the canvas practice quizzes than to the HW problems
  • Covers everything up to and including today
  • Symbols matter
  • CHARGE YOUR COMPUTER THE NIGHT BEFORE.

4 of 7

Quiz 2 - Wednesday Logistics

  • Please arrive at the auditorium on-time (there will be a hard deadline of 50 minutes; if you arrive late, that will eat into your time)
  • When you get here do not sit directly next to another person. There should be at least one seat between you and the closest person. You may use the Balcony.
  • As soon as you get seated, go ahead and open your computer and make sure you are connected to the EDUROAM network (we log IP addresses).
  • Open the Lockdown Browser application, and get logged into Canvas. The Quiz will automatically appear and enable at the start of your registered class time.
  • MAKE SURE TO BRING YOUR WILDCARD and have it out and easily accessible
  • If at any time you receive an error saying you're not connected to the network. You need to raise your hand IMMEDIATELY and a proctor will come help you.

5 of 7

Getting Serious about Data

5

6 of 7

Data Filter Example: Warm-Up

  • Open the file data_filter.py
  • Let’s do the following exercises using a for loop:
    • Print each “sub-list” (note that people is a list of lists) to the screen using a for loop
    • Print only the name for each person
    • Print the name and the job of each person

6

7 of 7

Data Filter Functions: data_filter.py

  • Create a function called any_90210 that takes a list of people as an argument and returns a boolean representing the answer to the question.
  • Create a function called get_list_of_zip_codes that takes a list of people as an argument and returns a list of zip codes (i.e., a list of strings). (Challenge: have it return a list of unique zip codes)
  • Create a function called is_jersey_film_editor that takes in a single person as an argument and returns whether or not that person has an occupation of "Editor, film/video" and is from New Jersey
  • Create a function called, get_jersey_film_editors that takes as input a list of people and returns a subset of the original list of people who are Film editors from New Jersey.
  • Challenge: Create a function called filter_by_occupations_or_states that takes as input three lists: one of people, one of occupations, and one of states; and returns a subset of the list of people who either have one of the given occupations or live in one of the given states.

7