The 'in' Operator


#1


https://www.codecademy.com/courses/python-beginner-en-KAgt5/0/3?curriculum_id=4f89dab3d788890003000096#

It Says The Following Error Message When I run It:

Oops, try again. It looks like you did not print out every key in my_dict.

I can't Figure it Out

I expected to print out: For each key in my_dict: print out the key , then a space, then the value stored by that key.


Here Is My Code:

my_dict={
    'Name': 'Bob',
    'Phone': '123-456-7890',
    'e-mail': 'bob@bob.com'
    }
    
print(my_dict.keys())
print(my_dict.values())
 
 
for key in my_dict:
    print(key, my_dict[key])


#2

using parentheses with print makes it a tuple, don't use parentheses with print in python2


#3

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