Lab: Dictionaries#

This test will help you better understand how to use dictionaries.

Part 1: Using Dictionaries#

In part 1 you’ll create and manipulate a dictionary.

1. Create a Dictionary#

Create a dictionary called courses that contains the following:




Python Programming for Everyone


Introduction to Networking


Introduction to UNIX/Linux


Computer Security Fundamentals

[ ]:

2. Print a Key#

Use the courses dictionary you created. Write a print statement that prints the title of cis-15.

[ ]:

3. Change a Value#

The name of CIS-15 changed to “Python Programming for Everyone”. Change the value in courses to reflect the new name.

[ ]:

4. Add a Key#

Write a statement that adds one key value pair:

  • Key: cis-54

  • Value: Introduction to Relational Databases

[ ]:

5. Remove a Key#

Write a statement that removes cis-81 from the dictionary.

[ ]:

6. Test for a Key#

Write an expression that results to True if the cis-81 key is in courses and False otherwise.

[ ]: