How to count the number of zeros in each position of the sublist using python? -


i have 4 sublist in list below of length 38, want count number of 0 on each position. please how do it?

[[01100000100000000001100001001110100000],[01100000100000000001100001001110100000], [01100000100000000001100001001110100000], [01100000100000000001100001001110100000]]

the first index of 4 sublist 0000, hence number of 0 4. second index of 4 sublist 1111, hence number of 0 0. how want count 38 positions.

it's not clear question if numbers lists or strings. assuming they're strings (otherwise use bin()), i'd use zip() separate each position count() '0':

numbers = ['01100000100000000001100001001110100000',            '01100000100000000001100001001110100000',            '01100000100000000001100001001110100000',            '01100000100000000001100001001110100000'] [digits.count('0') digits in zip(*numbers)] 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -