Question
Python Coding Problem: Read a string of 1's and 0's. Count numbers of successive 1's and number of successive 0's, until the end. Note: Do
Python Coding
Problem: Read a string of 1's and 0's. Count numbers of successive 1's and number of successive 0's, until the end.
Note: Do NOT use string.find function.
Note: this is related to run-length encoding, a technique for compressing images. If the 1's and 0's represent a black and white image, there are often long strings of successive 1's and long
strings of successive 0's (black and white portions of the image). The run-length representation often takes up much less space than the original image. In general, compression techniques
allow you to store large photos on your phone and send them by e-mail.
Example:
Please enter a string of 0s and 1s: 1111000111111100000
Your string has:
4 1's
3 0's
7 1's
5 0's
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started