completes day 3 part 1.

This commit is contained in:
2022-12-12 17:16:05 -05:00
parent 1cc8907e81
commit 5546be7204
2 changed files with 8 additions and 2 deletions

View File

@@ -297,4 +297,4 @@ TgbpGblWlMsjgWlgMfpNRgbRHHBnHHHtLpCJPCPBnBLJtQQL
sbTlblTlvRbbGblbFcdDzccVcDVvzzzd
zMzfzlGwSBMMSCMzhsPgfcPcfcbhjQPt
FHHqJVdJmFmdVrJdJppthscjGtqRPRcccgcQbR
rvNJJpLrvvLnJvNFFvZZZBWznBWGSDCMnCwz
rvNJJpLrvvLnJvNFFvZZZBWznBWGSDCMnCwz

View File

@@ -37,15 +37,21 @@ priorityValue = {
}
for line in input:
print("Line: " + line)
lineLength = len(line) - 1
print("Length of line: " + str(lineLength))
lineLength = int(lineLength / 2)
print("Line Length: " + str(lineLength))
pack1 = line[:lineLength]
print("Pack 1: " + pack1)
pack2 = line[lineLength:]
print("Pack 2: " + pack2)
dupItem = ""
for item in pack1:
if (pack2.__contains__(item)):
dupItem = item
print(dupItem)
# print(dupItem)
break
total += determinePriority(dupItem)
print(total)