Python program to find missing number in an array

def missingnumber(n):
num= set(n)
l=len(n)
result=[]
for i in range(1, n[-1]):
if i not in num:
result.append(i)
return result
l1= [1, 2, 3, 5]
print(missingnumber(l1))

1 Like

@dinavahibhavya

Correct, keep it up.

1 Like