0
How do I run this code in python3?
I am coding a RPG and am following a video walkthrough on YouTube. He was using python 2 and I was using python 3 so there are some slight differences between our codes. He was creating weapons for the store() and was set up like this: weapons = ("Great Sword" : 40). The 40 stands for the cost of gold, which the player obtains in game. when I try to run this I get a syntax error. How do I run this in python 3?
3 Antworten
+ 5
if it is a dictionary then change to curly brackets
weapons = {"Great Sword" : 40}
if it is a tuple then:
weapons = ("Great Sword", 40)
tho i think the second choice can be omitted
since i suppose that is the initialization of a dictionary which will have more weapons added later on
so i'd go with the first one
+ 5
\●/
||
/\
+ 1
thanks for the help Bar Galili. it worked.