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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!