0
Dictionary
Can anyone give more exaples of dictionaries? Like from games or smthing
4 Respostas
+ 2
Can you provide a bit of an example of what you are looking for.
Otherwise, the Python tutorials give very good examples of dictionary uses.
+ 1
I mean i want to know where i can use dictionaries. Numbers, words or colors don't work with me. I am looking for example like from games because i like games. Can i use dictionary to categorise weapons like this:
weapons={
"sword" :["long sword", "excalibur", "dagger"]
"axe" :["machete"... Etc]
}
Can it be used like this?
+ 1
Kul Bart
copy this to play with:
weapons = {
'swords': ['long','short','broad'],
'knives': ['dagger','dirk','razor'],
'clubs' : ['mace', 'staff', 'flail']
}
print(weapons['swords'],'\n')
[print(i) for i in weapons['knives']]
print()
print('mace' in weapons['clubs'])
+ 1
Thanks