still guessing, but maybe
foo = '11111111111000000000000000000000' for char in foo: if char == '1': print('ok') else: print('ng')lines 3-6 can be replaced with single line:
print('ok' if char == '1' else 'ng')something else
from collections import Counter foo = '11111111111000000000000000000000' print(Counter(foo))This last snippet will output
Output:Counter({'0': 21, '1': 11})
You get the number of 0s and 1s
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs