educative.io

Lists - Full Speed Python

In your console in Chrome, your example is:
l = [1, 2, 3, 4, 5]
print(l) #prints the entire list
print l[0]#prints value at index 0
print l[1]#prints value at index 1

And when I run it from your console, it works. But actually isn’t it wrong since you did not enclose the item in parentheses? The way you showed does not work in common Python interpreters or IDEs…


Course: Full Speed Python - Learn Interactively
Lesson: Lists - Full Speed Python