How to set (change) an item in 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']
 
setitem(a, 1, 99)
print(a)

setitem(b, 2, 'y')
print(b)

setitem(c, 4, 'c#')
print(c)


 
'''
run:
 
[0, 99, 1, 3, 2, 3, 4, 6, 3]
['x', 'b', 'y', 'z', 'c', 'a']
['c++', 'python', 'php', 'java', 'c#']

'''

 



answered May 31, 2019 by avibootz
...