How to check if a string contain only of 1 and 0 in Python

1 Answer

0 votes
string = '10011100101'

result = all(ch in '01' for ch in string)

print(result)



'''
run:

True

'''

 



answered Apr 12, 2023 by avibootz

Related questions

1 answer 118 views
...