+ 2
What's wrong with my code
grocery_list = ["juice", "tomatoes", "potatoes", "bananas"] print("first item", grocery_list[0])
7 Respostas
+ 6
The print statement in your code IS spaced. Delete that space, and then you will have no problem. I checked I was correct by copying the text into the code editor, then I ran it. It said unexpected indent before print. So I deleted the space, and it ran perfectly without any errors!
+ 4
Your print () is indented. In Python everything has to be indented perfectly ;) Just remove your white space before print statement. It is like this:
print("first item", grocery_list[0])
This how it should be:
print("first item", grocery_list[0])
+ 2
@code-junkie in python you use indents (tabs/spaces) instead of { } (java, js, c#) to denote a code block, in your code print() was indented (you had a space in front of it) telling python that it was a code block belonging to something ... that it wasn't there.
+ 1
Yes!
+ 1
Press backspace before (p)letter in your print statement.
You probably pressed space by accident that's all.
0
I still don't get it
0
oh thx