Write Python Program Binarystringcountpy Counts Number 0 S 1 S Binary String Start Countin Q37053029

Write a Python program (binary_string_count.py) that counts thenumber of 0’s and 1’s in a binary string. Before start counting,the program should check if the string is a binary or not; you cando that by using the same function in program 8 – 3.

Your program should contain three functions:

(1) check_binary(str): This function takes in str (a string) asa parameter, and returns boolean (True or False). (Submit for 2points)

True: If ALL characters consist of 1 and/or 0 only.

False: Otherwise.

(2) binary_count(str): This function takes in a binary string (astring) as a parameter, and returns the number of 0’s and 1’s inthe binary string

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.