DEV Community

Viper
Viper

Posted on

Advent of Code 2020: Python Solution Day 25

Finally the last day. I have not scored any ranks but this was a fun challenge and I am grateful to know about this challenge. For this day, we had only one part challenge and which was not that hard. But again I took code from here.

My repository with all solution is available here. And write some blogs about ML on my GitHub Page at q-viper.github.io.

my_input = """
12578151
5051300
"""

test_input = """
5764801
17807724
"""

my_input=my_input.split("\n")[1:-1]


card_pkey = int(my_input[0])
door_pkey = int(my_input[1])


card_loopsize = 0

temp = 1
while temp != card_pkey:
    temp = (temp * 7) % 20201227
    card_loopsize += 1
print(f"Card's Loopsize: {card_loopsize}")

door_loopsize = 0
temp = 1
while temp != pk_door:
    temp = (temp * 7) % 20201227
    door_loopsize += 1
print(f"Door's Loopsize: {door_loopsize}")

temp = 1
for i in range(loopsize_card):
    temp = temp * door_pkey % 20201227
print(f'Part 1: {temp} (card -> door)')
Enter fullscreen mode Exit fullscreen mode

Oldest comments (0)