Dec 05: Review and PA 3

Learning Objectives

After today's class, you should be able to:

  • Be able to complete quiz 6 a, including working with the CORGIS json files
  • Understand part C of PA 3
  • Step through recursion

Announcement

  • Programming Assignment 3 PA 3
    • Part C due Thursday Dec 7th

Today's class

Work through Quiz 6 A

  • Go to canvas for the canvas portion and to retrieve the coding problems
  • Creat a directory for this work and download the skyscrapers json file into your director
  • CORGIS
    • Collection of Really Great, Interesting, Situated Datasets
  • Example: County Demographics

JSON Example

import json
from pprint import pprint

with open("county_demographics.json") as file:
    data = json.load(file)  # dictionary

for item in data:
    if item["County"] == "Harrisonburg city":
        pprint(item)

  • Add code to print counties whose percent 65 and older is greater than 30%
for item in data:
    if item["Age"]["Percent 65 and Older"] > 30.0:
        print(item["County"])

Tour of resources for the final

  • log onto canvas …
  • previous lectures

Your To-Do List

PA 3

  • Part C

Prepare for Quiz 6B on Thursday

  • Nested data
  • List comprehension
  • Recursion
  • Python program using JSON data

Prepare for the final

times