Advent of Code 2023 Day 1 - Python walkthrough

preview_player
Показать описание
Hi! My goal for this year was to record a walkthrough for each day, meant for people with basic knowledge of Python to go through each day of the year.

Part 1 0:00
Part 2 4:56
Pitfall explanation 7:32
Part 2 cont 9:07
Рекомендации по теме
Комментарии
Автор

Thanks! This year's day 1, part 2 is definitely not a typical day 1!

ViennaMike
Автор

really smart solution for that part two

drgold
Автор

In enumerate(digital_names, start=1) for the 2nd part

palgun.
Автор

Can you show the "ugly" way further? I try to create my own solution with your help and the "ugly way" is the only way i understand.

If I go further with the "ugly way", i have all numbers in my list ['1', '2', '3', '8', '1', '2', '3', '4', '5', '7'] but i cant get the program to a) only add the first and last char per line b) add the chars to "one entry" like '12' instead of '1', '2'

allywar.s
Автор

I am very new to Python and I am trying to use AoC to learn more. Can you explain the very first line:

def main(input):

How is this pulling the input? I was copy and pasting the input into an .txt file and trying to pull the input from that text file. But I can't figure out how to pull the information from a .txt file using your code. Thanks in advance for any help you can provide! Sorry if this is a very elementary question. I'm just trying to follow along with other people's code to learn

WooferG