How to get an item of specific index of a list using sequence operator as function in Python

1 Answer

0 votes
from operator import *    
 
a = [0, 3, 1, 3, 2, 3, 4, 6, 3]     
b = ['x', 'b', 'a', 'z', 'c', 'a']
c = ['c++', 'python', 'php', 'java', 'php']
 
print(getitem(a, 1))

print(getitem(b, 0))

print(getitem(c, 2))

 
'''
run:
 
3
x
php

'''

 



answered May 31, 2019 by avibootz
...