Investing in stock bug..?


#1

Heres my code

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

Here's the error

File "python", line 9
"apple": 0
^
SyntaxError: invalid syntax

I dont see what could be wrong with my code??


#2

Hi @textplayer42972 ,

Because the code that you posted is not formatted, it is difficult for other users to read and debug it. After code has been pasted into the editing window for posting, you can format it by selecting it, and then by clicking the </> button above the editing area. Alternatively, you can place three backquotes on the line before the code and three backquotes on the line after the code. This will enable us to see important details, such as the indentation and underscores. If you use the backquotes, your code will be color-coded, making it especially easy to read.

You are missing three commas in here ...

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