Lists

Nested Lists 1


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.