Если ноль не входит в последовательность:
N = int(input())
x = int(input())
check = False
while x != 0:
if x == N:
check = True
x = int(input())
print(check)
Если ноль входит в последовательность:
N = int(input())
x = N + 1
check = False
while x != 0:
x = int(input())
if x == N:
check = True
print(check)
N = int(input())
isN_once = 0
a = 1
while a != 0:
a = int(input(""))
if isN_once == 0:
if a == N:
isN = True
isN_once = 1
continue
else:
isN = False
continue
print(isN)