I want to find the highest number not in the list. The break should end the last for loop and leave me with Ans = highest number not in list. Why doesn't it work
A = [1,3,5,9,11]
u = A[0]
for i in range(1, len(A)):
if A[i] > u:
u = A[i]
if u <= 0:
Ans = 1
else:
for j in range(u ,0, -1):
if j not in A:
Ans = j
print(Ans)
break