0
How can I fix my code?
I made my code choose a random number. Based on the number generated, the player receives a different item. However, I'm trying to add weapons with different ammo counts into a broad (list?) basically: items = [] this list contains swords as well. So, how can I place items in there, that have a name and an ammo count? sorry it's so messy. and thanks in advance :D https://code.sololearn.com/c9DG07ezqdNw/?ref=app
7 Answers
+ 11
might wanna look into a dictonary?
myDic={"wand":6, "milk":2}
print(myDic["milk"])
+ 6
@Stef
myDic["milk"]-=1
+ 3
.... walking on thin ice with those arguments XD
+ 3
@Ahri MyDic ??? Sounds something diff
+ 1
but how could i subtract one from milk in this instance? so instead of 2 it becomes 1?
+ 1
I'm trying to create something like this
https://code.sololearn.com/c64EnMckKUDs/?ref=app
0
thx :)