+=
This commit is contained in:
4
03/c.py
4
03/c.py
@@ -14,7 +14,7 @@ for data in rucksacks:
|
|||||||
left = data[:len(data)//2]
|
left = data[:len(data)//2]
|
||||||
right = data[len(data)//2:]
|
right = data[len(data)//2:]
|
||||||
common = ''.join(set(left) & set(right))
|
common = ''.join(set(left) & set(right))
|
||||||
tot = tot + priorities.rfind(common)+1
|
tot += priorities.rfind(common)+1
|
||||||
|
|
||||||
print("First answer: " + str(tot))
|
print("First answer: " + str(tot))
|
||||||
|
|
||||||
@@ -24,6 +24,6 @@ step = 3
|
|||||||
for i in range(start, end, step):
|
for i in range(start, end, step):
|
||||||
three = rucksacks[i:i+step]
|
three = rucksacks[i:i+step]
|
||||||
common = ''.join(set(three[0]) & set(three[1]) & set(three[2]))
|
common = ''.join(set(three[0]) & set(three[1]) & set(three[2]))
|
||||||
tot2 = tot2 + priorities.rfind(common)+1
|
tot2 += priorities.rfind(common)+1
|
||||||
|
|
||||||
print("Second answer: " + str(tot2))
|
print("Second answer: " + str(tot2))
|
||||||
|
|||||||
Reference in New Issue
Block a user