Question: I have to do this in recursive approach format should be (Python 2.7) def zeros (s): # count how many zeros in string def ones

I have to do this in recursive approach
format should be (Python 2.7)
def zeros (s):
# count how many zeros in string
def ones (s):
# count how many ones in string
def _main():
s =sys.argv[1]
zero = zeros(s)
one = ones(s)
total = zero + one
stdio.writef(...)
if __name__ == '__main__':
_main()
Problem 2. Implement the functions zeros ) and ones) inbits.py that takes a bit string (i.e., a string of zeros and ones) s as argument and returns the number of zeros and ones in s, each computed recursively. The number of zeros in a bit string is 1 or 0 (if the first character is 'o or '1') plus the number of zeros in the rest of the string; number of zeros of an empty string is 0 (base case). The number of ones in a bit string can be defined analogously. gapython bi tongy 10100 0210911010111 zeros-11, ones- 14, total-25
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
