--- /dev/null
+""" Calculate power consumption"""
+
+def most_common(digits):
+ ones = 0
+ for d in digits:
+ if d == '1':
+ ones += 1
+
+ if ones > len(digits)/2:
+ return 1
+ else:
+ return 0
+
+
+with open("3_1_input.txt") as f:
+ lines = [l.strip() for l in f]
+
+digits = list(zip(*lines))
+gamma_rate = []
+epsilon_rate = []
+
+for col in digits:
+ mc = most_common(col)
+ gamma_rate.append(str(mc))
+ epsilon_rate.append(str((mc + 1) % 2))
+
+gamma = int("".join(gamma_rate), base=2)
+epsilon = int("".join(epsilon_rate), base=2)
+
+
+
+print(gamma_rate, gamma)
+print(epsilon_rate, epsilon)
+
+print(gamma * epsilon)