list index out of range python meaning code example
Example 1: expect out of range in pytnhon
try:
gotdata = dlist[1]
except IndexError:
gotdata = 'null'
Example 2: list index out of range
def sort_list(l):
l=list(l)
for i in l:
if l[i]<=l[i+1]:
return True
else:
return False