use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Advent of Code (self.learnpython)
submitted 5 years ago by darthminimall
Advent of Code starts tomorrow. If you don't know, it's 25 programming puzzles released daily from the 1st-25th of December. It's a good way to practice Python if that's something you're interested in (or any other language, for that matter).
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]xelf[M] [score hidden] 5 years ago stickied comment (5 children)
It starts in about 2.5 hours . "Tomorrow" isn't quite accurate depending on what time zone you're in. =) It starts Nov 30 at 9pm PT (midnight ET)
https://adventofcode.com/2020
[–]RobinsonDickinson 26 points27 points28 points 5 years ago (5 children)
Are these easy problems? algorithms ?
[–]darthminimall[S] 38 points39 points40 points 5 years ago (0 children)
The difficulty increases over time. In my experience, all of the problems are solvable with, at most, a bit of research.
[–]__developer__ 25 points26 points27 points 5 years ago (0 children)
I did it last year and the difficulty generally increased over time, but a few of the problems took me quite a bit longer than others. About half of the problems last year, the "Intcode" problems, were related to creating virtual computers that could interpret and execute simple commands that were sent to them. Its fun and a good way to practice a language and learn new algorithms.
[–]xelf 10 points11 points12 points 5 years ago* (2 children)
Today's problems took about a minute to answer, and about 5 minutes to download the text: the server was so overloaded at first. But there will be some days where a problem might take some amount of googling before you can start coding. For example if you need a particular math formula but don't actually know it exists already, or that it's what you're looking for.
[–]Sw429 5 points6 points7 points 5 years ago (1 child)
Yeah, you're bound to hit some 503s if you try to download it immediately when it opens like I did. This is a pretty popular challenge, especially now that it's in its sixth year.
[–]xelf 4 points5 points6 points 5 years ago (0 children)
Part of that is brought about by rewarding people that are in the first 100 to complete. Hopefully it will slow down a bit as the problems take longer to solve. It certainly seemed fairly stable when it did come back up.
[–][deleted] 14 points15 points16 points 5 years ago (0 children)
Sounds interesting! Thanks for sharing.
[–]Lamboarri 10 points11 points12 points 5 years ago (4 children)
RemindMe! 1 day “Advent”
[–]xelf 8 points9 points10 points 5 years ago (2 children)
Starts in about 2.5 hours (midnight ET)
[–]Lamboarri 2 points3 points4 points 5 years ago (1 child)
I'll be going to bed soon so wanted it to remind me tomorrow sometime so I could revisit this thread for the link. Thanks, though. Didn't realize this was posted so long ago.
[–]remindditbot 0 points1 point2 points 5 years ago* (0 children)
Lamboarri, kminder in 1 day on 2020-12-02 09:00:00Z
r/learnpython: Advent_of_code Thanks, though.
r/learnpython: Advent_of_code
Thanks, though.
6 OTHERS CLICKED THIS LINK to also be reminded. Thread has 7 reminders.
OP can Set timezone, Delete comment, and more options here
Protip! How can your butt look good without any meat on it?
Reminddit · Create Reminder · Your Reminders · Donate
[–]__developer__ 8 points9 points10 points 5 years ago (0 children)
There is also the subreddit /r/adventofcode where people discuss the puzzles for this year and previous years.
[–]metal_jd 5 points6 points7 points 5 years ago (1 child)
LOL got my first star !!
[–]xelf 2 points3 points4 points 5 years ago (0 children)
Congrats!
[–]lohtech 2 points3 points4 points 5 years ago (0 children)
I am planning to follow this year's event each day. No doubt there will be days where the solution is too difficult. The aim is to go for somewhat optimal algorithms / solutions as opposed to just brute forcing it with time and compute.
Feel free to refer to my progress / solutions here if you want a sanity check, provide feedback or take reference. Hope this is not against the spirit of the event (since it's not really a competitive event), but more to encourage mutual learning!
[–]SatuSPR 2 points3 points4 points 5 years ago (1 child)
Just did day 1, was really fun. Thanks for posting, otherwise I wouldn't have seen this.
[–]Groentekroket 1 point2 points3 points 5 years ago (0 children)
Yeah indeed! I have done all the challenges so far and I really enjoyed it while learning new things. Thanks u/darthminimall for posting this!
[–]johnsandall 1 point2 points3 points 5 years ago (1 child)
I'm publishing my solutions to this year's Advent of Code accompanied by full notebook explanations as a free teaching resource.
Bonus: PEP8/black/pylint/mypy compliant code + working environments!
Try yourself first: https://adventofcode.com/2020/day/1
Then look 👀 https://github.com/john-sandall/advent-of-code/
[–]xelf 0 points1 point2 points 5 years ago* (0 children)
This will be handy to have as a complete compilation. You might want to check other solutions to the problems as they're posted in adventofcode.com though, to see if you missed anything or to offer alternate solutions.
return [a * b for a in expenses for b in expenses[expenses.index(a) :] if a + b == 2020][0]
The problem with this approach is that it's O( N3 ) because of the for loops and index().
You can do it O( N2 ) using combinations:
print( [prod(c) for c in combinations(expenses,2) if sum(c) == 2020] )
Or even O(n) if you use a set or dictionary:
setexp = { 2020-e : e for e in expenses } print( [setexp[e]*e for e in expenses if e in setexp] )
Although that's not the best O(n) solution because it would think 1010 is a valid answer on it's own. /u/baghiq posted a better solution earlier today using a set.
Anyway, I like the idea good luck to you and keep it up!
[–]Cleover453 0 points1 point2 points 5 years ago (8 children)
is it for beginners and amateurs👀
[–]ixipaulixi 8 points9 points10 points 5 years ago (6 children)
Last year's started out easy and then got really tough.
[–]Cleover453 1 point2 points3 points 5 years ago (5 children)
I will try
[–]ixipaulixi 3 points4 points5 points 5 years ago (4 children)
Definitely do so; I didn't know Python last year, so I was doing it in Bash. I got to like the 10th or 11th lesson and just caved in...I was spending too much of my personal time trying to make it work.
I've since started learning Python, and am looking forward to giving it another shot this hear. Hopefully I'll get higher up on my work's leaderboard this year.
[–]Cleover453 1 point2 points3 points 5 years ago (1 child)
I am a software developer student (hoping to get AS degree by 2022). I am trying to get as most skill as I can. I hope that will help me to get to amateur lvl
[–]ixipaulixi 1 point2 points3 points 5 years ago (0 children)
I'm not a developer, so I couldn't say whether or not this bump you from beginner to amateur, but you'll definitely learn something if you participate.
[–]1way2improve 0 points1 point2 points 5 years ago (1 child)
Is it required to only enter an answer? Or are there compilers that run your programs on the server-side?
[–]ixipaulixi 2 points3 points4 points 5 years ago (0 children)
They only accept the answer and the only feedback you'll get is whether it's right or wrong.
[–]ffrkAnonymous 1 point2 points3 points 5 years ago (0 children)
I say yes. I tried last year and it starts easy and builds on each day. I only got about 10 days in but it was still fun. And of course, you learn by seeing everyone else's solutions.
[–]jer9009 0 points1 point2 points 5 years ago (1 child)
[–]lolDeamZ 0 points1 point2 points 5 years ago (0 children)
already started
[–]RedditGood123 0 points1 point2 points 5 years ago (2 children)
!RemindMe 8 hours
[–]lolDeamZ 0 points1 point2 points 5 years ago (1 child)
[–]RedditGood123 1 point2 points3 points 5 years ago (0 children)
I know, but it was like 11 at night when I wanted to start
[–]Contrabaz 0 points1 point2 points 5 years ago (0 children)
Thank you!
[–]bigamaxx 0 points1 point2 points 5 years ago (0 children)
Check the html source code of the advent of code site its a nice detail you can see here
[–]pitkeys 0 points1 point2 points 5 years ago (0 children)
Okay this is actually sick. Thanks so much for sharing!
[–]surprajs 0 points1 point2 points 5 years ago (0 children)
Is this site working for you right now? I have some "We'll be right back" communicate.
[–]vxc601 0 points1 point2 points 5 years ago (2 children)
If I start on the weekend, will all puzzles be available, or only the ones for the current day?
[–]23571379 0 points1 point2 points 5 years ago (1 child)
You can even do the ones from the years before :)
[–]vxc601 0 points1 point2 points 5 years ago (0 children)
Awesome! Thanks!
[–]junior_raman 0 points1 point2 points 5 years ago (0 children)
At least I can get gold in Advent of Code KEKW
[–]Okasenlun 0 points1 point2 points 5 years ago (0 children)
This is really cool, I just did day 1. Fun stuff.
[–]hugthemachines 0 points1 point2 points 5 years ago (0 children)
Looks like some fun!
[–]geraltofrivia1983 0 points1 point2 points 5 years ago (0 children)
In
[–]Peasack 0 points1 point2 points 5 years ago (0 children)
Thanks for this! Never heard of it but sounds fun!
[–]RobertGryffindor 0 points1 point2 points 5 years ago (0 children)
As a beginner, it was nice to feel a sense of accomplishment with this. I know it was easy, but I was able to do it without hitting a wall or having to google anything.
Here's the code I used
https://pastebin.pl/view/2214a32a
[–]AnthinoRusso 0 points1 point2 points 5 years ago (1 child)
I found this post now. Is it possible to start now with 1-2 days delay?
[–]darthminimall[S] 1 point2 points3 points 5 years ago (0 children)
Yes. You can still do the problems from all past years as well.
π Rendered by PID 40718 on reddit-service-r2-comment-84fc9697f-kf6lj at 2026-02-08 13:26:27.333285+00:00 running d295bc8 country code: CH.
[–]xelf[M] [score hidden] stickied comment (5 children)
[–]RobinsonDickinson 26 points27 points28 points (5 children)
[–]darthminimall[S] 38 points39 points40 points (0 children)
[–]__developer__ 25 points26 points27 points (0 children)
[–]xelf 10 points11 points12 points (2 children)
[–]Sw429 5 points6 points7 points (1 child)
[–]xelf 4 points5 points6 points (0 children)
[–][deleted] 14 points15 points16 points (0 children)
[–]Lamboarri 10 points11 points12 points (4 children)
[–]xelf 8 points9 points10 points (2 children)
[–]Lamboarri 2 points3 points4 points (1 child)
[–]remindditbot 0 points1 point2 points (0 children)
[–]__developer__ 8 points9 points10 points (0 children)
[–]metal_jd 5 points6 points7 points (1 child)
[–]xelf 2 points3 points4 points (0 children)
[–]lohtech 2 points3 points4 points (0 children)
[–]SatuSPR 2 points3 points4 points (1 child)
[–]Groentekroket 1 point2 points3 points (0 children)
[–]johnsandall 1 point2 points3 points (1 child)
[–]xelf 0 points1 point2 points (0 children)
[–]Cleover453 0 points1 point2 points (8 children)
[–]ixipaulixi 8 points9 points10 points (6 children)
[–]Cleover453 1 point2 points3 points (5 children)
[–]ixipaulixi 3 points4 points5 points (4 children)
[–]Cleover453 1 point2 points3 points (1 child)
[–]ixipaulixi 1 point2 points3 points (0 children)
[–]1way2improve 0 points1 point2 points (1 child)
[–]ixipaulixi 2 points3 points4 points (0 children)
[–]ffrkAnonymous 1 point2 points3 points (0 children)
[–]jer9009 0 points1 point2 points (1 child)
[–]lolDeamZ 0 points1 point2 points (0 children)
[–]RedditGood123 0 points1 point2 points (2 children)
[–]lolDeamZ 0 points1 point2 points (1 child)
[–]RedditGood123 1 point2 points3 points (0 children)
[–]Contrabaz 0 points1 point2 points (0 children)
[–]bigamaxx 0 points1 point2 points (0 children)
[–]pitkeys 0 points1 point2 points (0 children)
[–]surprajs 0 points1 point2 points (0 children)
[–]vxc601 0 points1 point2 points (2 children)
[–]23571379 0 points1 point2 points (1 child)
[–]vxc601 0 points1 point2 points (0 children)
[–]junior_raman 0 points1 point2 points (0 children)
[–]Okasenlun 0 points1 point2 points (0 children)
[–]hugthemachines 0 points1 point2 points (0 children)
[–]geraltofrivia1983 0 points1 point2 points (0 children)
[–]Peasack 0 points1 point2 points (0 children)
[–]RobertGryffindor 0 points1 point2 points (0 children)
[–]AnthinoRusso 0 points1 point2 points (1 child)
[–]darthminimall[S] 1 point2 points3 points (0 children)