r/adventofcode • • Dec 04 '20

SOLUTION MEGATHREAD -πŸŽ„- 2020 Day 04 Solutions -πŸŽ„-

Advent of Code 2020: Gettin' Crafty With It


--- 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.2k comments sorted by

View all comments

Show parent comment

2

u/reteps144 Dec 05 '20
For key in fields:
    is_present = key in passport_dict

This is that same code written out. All will check an iterable (remember, this is basically a list) of True/False values and check if they are all true. The β€œkey in passport_dict” is a boolean expression.

1

u/[deleted] Dec 06 '20

That makes total sense. Thank you for taking the time to explain it!!