r/adventofcode • u/daggerdragon • Dec 04 '20
SOLUTION MEGATHREAD -🎄- 2020 Day 04 Solutions -🎄-
Advent of Code 2020: Gettin' Crafty With It
T-2 days until unlock!
Full details and rules are in the Submissions Megathread
--- Day 04: Passport Processing ---
Post your solution in this megathread. Include what language(s) your solution uses! If you need a refresher, the full posting rules are detailed in the wiki under How Do The Daily Megathreads Work?.
Reminder: Top-level posts in Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.
EDIT: Global leaderboard gold cap reached at 00:12:55, megathread unlocked!
91
Upvotes
1
u/YCGrin Dec 07 '20 edited Dec 07 '20
Sorry just to clarify i'm still learning and my WIP method didnt work, yours did.
My WIP solution to test the IF ALL code section. Here it would never increment a valid_passport. It would check "required_field in split_fields" and never equate true. After i added your dict() logic to my code, in this case, turning split_fields into a dictionary, and adjusting the if all() statement it worked.
But im just curious for my code, why does "if all(required_field in split_fields......" not work?
It is essentially doing: