Skip to content

Instantly share code, notes, and snippets.

@DavidToca
Last active December 2, 2020 21:29
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 DavidToca/0786cb6c1a0375d13f908353c2d5bb57 to your computer and use it in GitHub Desktop.
Save DavidToca/0786cb6c1a0375d13f908353c2d5bb57 to your computer and use it in GitHub Desktop.
AoC 2020 day 2-1
response = 0
for case in input_data:
numbers, letter, work = case.split(' ')
min_number,max_number = numbers.split('-')
letter = letter[0]
min_number = int(min_number)
max_number = int(max_number)
letter_count = work.count(letter)
if letter_count >= min_number and letter_count <= max_number:
response+=1
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment