7. Investing in stock - invalid syntax


#1



I got this error. why? File "python", line 9
"apple": 0
^
SyntaxError: invalid syntax


prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}
stock = {
"banana": 6
"apple": 0
"orange": 32
"pear": 15
}


Replace this line with your code.


#2

Hi this dictionary

stock = {
"banana": 6
"apple": 0
"orange": 32
"pear": 15
}

should be like that

stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}

with a comma after each key/value


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.