American Young Coder

AYC logo
Loading Events

« All Events

  • This event has passed.

7 PM – Python OOP – Joel

March 11 @ 7:00 pm - 8:00 pm

Today we did:
  1. We learned how to loop through dictionaries, and did a short exercise. We also started the PhoneBookSystem.
Homework:

Create a new file called March11_DictionaryHomework and do the following:

    • 6-1. Person: Use a dictionary to store information about a person you know. Store their first name, last name, age, and the city in which they live. You should have keys such as first_name, last_name, age, and city. Print each piece of information stored in your dictionary.
    • 6-2. Favorite Numbers: Use a dictionary to store people’s favorite numbers. Think of five names, and use them as keys in your dictionary. Think of a favorite number for each person, and store each as a value in your dictionary. Print each person’s name and their favorite number.
    • 6-5. Rivers: Make a dictionary containing three major rivers and the country
      each river runs through. One key-value pair might be ‘nile’: ‘egypt’.
      • Use a loop to print a sentence about each river, such as The Nile runs
      through Egypt.
      • Use a loop to print the name of each river included in the dictionary.
      • Use a loop to print the name of each country included in the dictionary.
    • 6-6. Polling: Use the code here to know who took the polls (jen, sarah, edward, and phil all did):
    • favorite_languages = {
      ‘jen’: ‘python’,
      ‘sarah’: ‘c’,
      ‘edward’: ‘ruby’,
      ‘phil’: ‘python’,
    • • Make a list of people who should take the favorite languages poll. Include some names that are already in the dictionary and some that are not.
      • Loop through the list of people who should take the poll. If they have
      already taken the poll, print a message thanking them for responding.
      If they have not yet taken the poll, print a message inviting them to take
      the poll

Do your best with the homework, and if you’re not sure during the week, you can email me at joel@ayclogic.com. Remember to submit the homework before next week in the Google Drive folders you guys have.

Details

Date:
March 11
Time:
7:00 pm - 8:00 pm