How to find a value with a number

I’m not getting output with this syntax

List in python

     arr  = [5,2, 4,9]
  Index No.  0 1  2 3
length_list  =len (arr)
 arr[0]  
arr[3]

this is the actual syntax
index no 0’s value is 5 right
that is not coming in output

It works fine in IDLE here.

arr=[5,2,4, 9]
arr
[5, 2, 4, 9]
arr[3]
9
arr[0]
5

What tool are you using?

It is not getting.
I’m using sublime text.

Can you try in another tool?
It sounds like your sublime isn’t working as you expect.
It’s happy here in both IDLE and Jupyter Notebook.

Have you tried without the whitespace?

arr  = [5,2, 4,9]
arr[0]  
arr[3]

You might try using a print statement to print the output.

i.e.

arr = [0,1,2,3,4]
print(arr[0])
1 Like