Python Dictionary
Python Dictionary
Setup
Make a directory in your workspace, cd
into it, and create a file called slab_dict.py
mkdir -p ~/workspace/python/exercises
cd exercises
touch slab_dict.py
References
Instructions
In the Scholars’ Lab, each employee has a title. We can store that information in a dictionary.
Example
slab_staff = { 'Zoe_LeBlanc':'DH_Developer' ,
'Jeremy_Boggs':'Head_RnD', 'Brandon_Walsh' :'Head_GradPrograms' }
We can print out each person’s title by using either bracket notation
print(slab_staff['Zoe_LeBlanc'])
or dot notation.
print(slab_staff.Zoe_LeBlanc)
Try this
- Try creating a dictionary with all your fellow praxis student names and departments.
- Then try using bracket or dot notation to print out their department.