[Tutor] Calling a dictionary entry inside of a function
Corey Richardson
kb1pkl at aim.com
Sat Sep 19 02:27:23 CEST 2009
I am trying to use a parameter of a function to call a word inside a
dictionary.
Here is my code
wordList = {
'Apple' : ["A delicious snack"],
'Word' : ["This code is not working..."],
}
def define(word):
print wordList['Word']
When I use define('Apple') it returns ['This code is not working...'].
I tried defining word with a raw_input, but that didn't work, and I
wouldn't know how to have them define another word.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kb1pkl.vcf
Type: text/x-vcard
Size: 55 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20090918/20f57039/attachment.vcf>
More information about the Tutor
mailing list