Why my dictionary will not print the first line


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

Hello,
I have a problem here about Dicts, the problem is my print.my_dict.items or .values() dosnt print the first line!
it prints the rest of dictionary but the first line!
thank you so much in advance for your help


my_dict = {
  
  "dog": "miki",
  "cat": "shishi",
  "dog": "tami"
}
print my_dict.keys()
print my_dict.values()

#2

keys have to be unique, otherwise the keys get re-assigned. So your dictionary only contains 2 keys, as you can see:

my_dict = {
  
  "dog": "miki",
  "cat": "shishi",
  "dog": "tami"
}

# print entire dictionary
print my_dict

#3

OHHHHH.!! Thank you so much dear kind stetim94. <3 It was a great help


#4

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