Write a Python function to check if a string is binary or not
Topic: Write a Python function to check if a string is binary or not
Solution
def check2(string) : t = '01' count = 0 for char in string : if char not in t : count = 1 break else : pass if count : print("No, string is not binary") else : print("Yes, string is binary") string = "001021010001010" check2(string)
List all Python Programs