Header Ads

Header ADS

toc p:8 Design a program for creating a machine that counts the number of 1’s and 0’s in a given string.

 # this line for declaring a variable and its value

myText = "I love 00001111, 00001111 is my favorite binary no"

# this line for calling the count method

numofCounts = myText.count("00001111")

# this line for print output

print("{} number of times".format(numofCounts)) # format is the inbuilt


No comments

Powered by Blogger.