Skip to content

george-williamson/advent-of-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

24 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ„๏ธ Advent of Code Solutions โ„๏ธ

A repository to store my solutions to the annual advent of code puzzles. All of my solutions are written in Python.

๐Ÿ“ Learnings

๐Ÿ Python

2-element list indexing using a boolean:

This is extremely useful when you binary choices for indexing. It can remove the need to write an if else statement depending on what the value of the index is.

list = ['a', 'b']
list[False]
> 'a'
list[True]
> 'b'
list = ['XXX', 'ZZZ']
current = 'R'
list[current=='R'] # this statement is true
# has chosen the right element
> ZZZ 

iterools.pairwise

Allows you to get the successive overlapping pairs in any iterable.

from itertools import pairwise
list(pairwise(list(range(5))))
> [(0, 1), (1, 2), (2, 3), (3, 4)]

https://docs.python.org/3/library/itertools.html#itertools.pairwise

๐Ÿง  Algorithm Patterns

Algorithm learnings go here.

Misc

Misc learnings go here.

About

My solutions to Advent of Code, written in Python.

Topics

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages