r/adventofcode • u/daggerdragon • Dec 06 '17
SOLUTION MEGATHREAD -π- 2017 Day 6 Solutions -π-
--- Day 6: Memory Reallocation ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).
Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
Need a hint from the Hugely* Handyβ Haversackβ‘ of HelpfulΒ§ HintsΒ€?
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked!
16
Upvotes
View all comments
Show parent comment
1
u/KnorbenKnutsen Dec 06 '17
You can use the
mapfunction to handle your input a little cleaner:args = list(map(int, "INPUT STRINGS HERE".split()))Also, instead of copying the lists, I would append
tuple(args)toprevious. They're immutable, so you can trust that the comparison will be by value and not by reference (and they're hashable in case you'd want to use adictor aset. Just some tips since you say you're learning Python :)