This next part is key


#1



https://www.codecademy.com/courses/python-beginner-en-pwmb1/2/1?curriculum_id=4f89dab3d788890003000096#


It looks like the value stored under "Sloth" was not printed.


# Assigning a dictionary with three key-value pairs to residents:
residents = {'Puffin' : 104, 'Sloth' : 105, 'Burmese Python' : 106}

print residents['Puffin'] # Prints Puffin's room number

# Your code here!
print residents['Sloth'and 'Burmese Python']


#2

There is no such key as ['Sloth'and 'Burmese Python']. The keys you have are ['Puffin'], ['Sloth'], and ['Burmese Python'].


#3

@datfatcat thanks for your help


#4

could only make work if each was called on a separate line:

print residents['Sloth']
print residents['Burmese Python']

is this the only way? or can you call multiple keys on one line such as:

print residents['Sloth'] and ['Burmese Python']

or

print residents['Sloth', 'Burmese Python']

or another way?


#5

If you want the console to display:

105
106

Then it is best to do it on separate lines.
If you want to print multiple keys on one line so console looks like this:

105 106

Simply do

print residents['Sloth'], residents['Burmese Python']

Byebye
#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.