Created
December 16, 2021 05:11
-
-
Save loudambiance/ceb185fae2abb1e7b2f4270ffed88ead to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('task3a.txt') as f: | |
lines = [] | |
for ele in f: | |
lines.append(list(ele.strip('\n\r '))) | |
gamma = ''.join([ max(x, key=x.count) for x in zip(*lines) ]) | |
epsilon = ''.join('1' if x == '0' else '0' for x in gamma) | |
power = int(gamma, 2) * int(epsilon,2) | |
print(power) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment