Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

index in python

#index with eval()
k=eval(input("enter the list"))
for i in range(len(k)):
    print(k[i],"-->forward index",i,"backward index",-(len(k)-i))
#output
enter the list[1,9,5,7]
1 --> forward index 0 backward index -4
9 --> forward index 1 backward index -3
5 --> forward index 2 backward index -2
7 --> forward index 3 backward index -1
 
PREVIOUS NEXT
Tagged: #index #python
ADD COMMENT
Topic
Name
1+7 =