Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass
Created December 4, 2020 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffersGlass/cf670f595c99db49b8564cc600ce26c6 to your computer and use it in GitHub Desktop.
Save JeffersGlass/cf670f595c99db49b8564cc600ce26c6 to your computer and use it in GitHub Desktop.
fields = ['byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid']
with open ('input.txt', 'r') as infile:
everyLine = ''.join([line for line in infile])
passports = [p.replace('\n',' ') for p in everyLine.split('\n\n')]
print(f"Solution to part 1 is: {len([p for p in passports if all(f in p for f in fields)])}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment