Why my code is showing NZEC
while True:
n=int(input())
if n!=42:
print(n)
else:
break
Why my code is showing NZEC
while True:
n=int(input())
if n!=42:
print(n)
else:
break
Put it in a try block
consider
1
2
3
you will have an exception because you’re attempting to read from empty input. Catch that and it won’t show NZEC.
Or restructure your code to the following:
n = int(input().strip())
while n != 42:
print("{0}".format(n))
n = int(input().strip())
How to become good in coding ?
Thanks, bro