python if index not out of range
def double_index(lst, index):
try:
lst[index] = lst[index] * 2
except IndexError:
return lst
Are there any code examples left?
New code examples in category Python
def double_index(lst, index):
try:
lst[index] = lst[index] * 2
except IndexError:
return lst