def find_missing(sequence): #[1,3,4,6,7,8]
result = []
if len(sequence)>2:
a = min(sequence[1] - sequence[0],sequence[2] - sequence[1]) #1
#sequence = str(sequence)
for i in range(0,len(sequence)):
if sequence[i+1] - sequence[i] != a:
return sequence[i]+ a
return -1
find_missing([1,2])
0 Comments