How do I run this code in python3? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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?

7th Nov 2016, 7:22 PM
Deashawn Gamble
Deashawn Gamble - avatar
3 Answers
+ 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
7th Nov 2016, 8:00 PM
Burey
Burey - avatar
+ 5
\●/ || /\
7th Nov 2016, 8:15 PM
Burey
Burey - avatar
+ 1
thanks for the help Bar Galili. it worked.
7th Nov 2016, 8:10 PM
Deashawn Gamble
Deashawn Gamble - avatar