Skip to content

Latest commit

 

History

History
34 lines (29 loc) · 1.14 KB

Lists-nested-lists-1-Python.md

File metadata and controls

34 lines (29 loc) · 1.14 KB
layout topic title language
exercise
Lists
Nested Lists 1
Python

Use slices from the following list of lists that contains information about characters in Harry Potter to answer the questions below. Each sublist contains the last name, first name (if the character has two names) and occupation of a single character. Paste the list into your code to get started.

harry_potter_characters = [['Potter', 'Harry', 'Student'], ['Dobby',
'House Elf'], ['Granger', 'Hermione', 'Student'], ['Hagrid', 'Rubeus',
'Keeper of Keys and Grounds']]

Print the following lines with the the appropriate answers inserted into the blanks by taking slices from the list:

  1. Harry ______________ is a ______________ at Hogwarts.
  2. The Keeper of Keys and Grounds at Hogarts is ______________   ______________ who is typically refered to only by his last name.
  3. The entire entry in the table for Hagrid is _________________________________________________. [i.e., print out the sublist for Hagrid]
  4. Dobby is a ______________.
  5. ______________ Granger has a time-turner, which would be really useful for completing this homework.