check if index out of range python code example
Example: python if index not out of range
def double_index(lst, index):
try:
lst[index] = lst[index] * 2
except IndexError:
return lst
def double_index(lst, index):
try:
lst[index] = lst[index] * 2
except IndexError:
return lst