Skip to content

Instantly share code, notes, and snippets.

Created December 3, 2016 22:11
Show Gist options
  • Save anonymous/dc063f1fcb48701c0701326a9880c066 to your computer and use it in GitHub Desktop.
Save anonymous/dc063f1fcb48701c0701326a9880c066 to your computer and use it in GitHub Desktop.
Advent of code Day 3 - 1
import sys
valid_triangles = 0
def valid_triangle(a, b, c):
return ((a + b) > c) and ((b + c) > a) and ((c + a) > b)
for line in sys.stdin.readlines():
if valid_triangle(*[int(x) for x in line.strip().split()]):
valid_triangles += 1
print(valid_triangles)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment