Skip to content

Kevin2259/survey-says-nested-data-structures-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Survey Says!

Run on Repl.it

The Goal

The information in the database file attached here has results from a survey Jeff took of some of his friends. He's going to use that information to learn some things about the friends who answered the survey. For example:

  • What percent of his friends are programmers?
  • Do they like similar or dissimilar music?
  • How many of them live in each state?

One warning: these are real people, and real people don't always provide the easiest data to work with. Get ready for typos, unexpected blanks, and outright silliness (Max, for example, isn't 100 years old).

In the challenge.py file, Jeff has written some questions he has. Use your knowledge of lists and dictionaries to get at the information asked for in each of the 9 challenges.

Getting Started

If you already have a good idea of how to start this based on previous labs, go for it!

If you're struggling to get started, click here for some tips

Try to get a feel for the shape of the data by adding the three print statements below to the challenge.py file:

import database

# All the survey responses are stored in a list called "people".
print(database.people)
print("THE FIRST PERSON IS:")
print(database.people[0])
# 1. Print out the name of the first person who responded to the survey

Then run the code in the console:

python challenge.py

You'll notice that the real trouble is that it's providing WAY more than that person's name. It's providing their entire dictionary.

That means the answer to challenge 1 will look something like this:

# 1. Print out the name of the first person who responded to the survey
print(database.people[0]["some_string_here"])

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%