Write a program that takes a string as input and prints “Binary Number” if the string contains only 0s or 1s. Otherwise, print “Not a Binary Number”.
s = input()
for ch in s:
if ch != '1' and ch != '0':
print('Not a Binary Number')
break
else:
print('Binary Number')
Comments
Leave a comment