Saturday, 18 October 2014

Dictionary


Dictionary:

an_example_dictionary ={1:"No Way!",2:"Hatchee How",3:"wambambam",4:"Pow!"}
print(an_example_dictionary)
print(an_example_dictionary[3])



an_example_dictionary2 ={"1":"No Way!","2":"Hatchee How","3":"wambambam","4":"Pow!"}
print(an_example_dictionary2)
print(an_example_dictionary2["3"])






2nd way:

dictionary={}
dictionary['1']=['a','b','c']
print(dictionary)
dictionary['2']=['d','e','f']
print(dictionary)








3rd way:
dictionary_non_literal={}
dictionary_non_literal[1]=['a','b','c']
dictionary_non_literal[2]=['a1','b1','c1']
print(dictionary_non_literal)

1 comment:

  1. Your blog is great, for a number of reasons! First, I like the way you have displayed your screenshots, it's extremely user friendly & it is quite easy to see what each code will display. Secondly, I appreciate the blog titles, because it makes it very easy to find what we are searching for.

    However, I think you should elaborate a bit more on your written content because you have left all the understanding up to the reader, and sometimes this understanding may be flawed. I think you should point the reader in the right direction.

    ReplyDelete