Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to check if given number is binary in pytho

string = "101010000111"
p = set(string)

s = {'0', '1'}

if s == p or p == {'0'} or p == {'1'}:
    print("Yes")
else :
    print("No")
 
PREVIOUS NEXT
Tagged: #check #number #binary #pytho
ADD COMMENT
Topic
Name
7+5 =