Its the best way for writing the code in python >3.5 version
a= int(input())
if a:
list1.append(a)
else:
break
even if you want to put a limit for the number of values you can go like
while s>0:
a= int(input())
if a:
list1.append(a)
else:
break
s=s-1