Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This creates a data dictionary of musicians including the id, genre, talent, and country.
- musicians ={
- "Joe": {"id": "1", "age": 25, "genre": "heavy metal", "talent": "singer", "country": "United States"},
- "Jackie": {"id": "2", "age": 20, "genre": "country", "talent": "Harmonica", "country": "United States"},
- "Mark": {"id": "3", "age": 18, "genre": "psychadelic rock", "talent": "guitar", "country": "U.K."},
- "Jenna": {"id": "4", "age": 21, "genre": "pop", "talent": "singer", "country": "Sweden"},
- "Moe": {"id": "5", "age": 30, "genre": "heavy metal", "talent": "drums", "country": "Germany"}
- }
- #This obtains and prints the entire data dictionary.
- print ("Here is the entire data dictionary printed")
- print (musicians)
- #This obtains and prints Jackie's genre, selecting one item from the data dictionary.
- print ("Here is Jackie's genre:")
- print (musicians["Jackie"]["genre"])
Advertisement
Add Comment
Please, Sign In to add comment