r/adventofcode • • Dec 02 '15

Spoilers Day 2 solutions

Hi! I would like to structure posts like the first one in r/programming, please post solutions in comments.

15 Upvotes

161 comments sorted by

View all comments

Show parent comment

2

u/volatilebit Dec 02 '15

Would this code

l, w, h = line.split('x')
l, w, h = int(l), int(w), int(h)

be more "pythonic" written as...

l, w, h = [int(i) for i in line.split('x')]

2

u/stuque Dec 03 '15

Maybe. I find the two-lines clearer than the single-line solution.

2

u/rafblecher Dec 03 '15

I usually go for

l, w, h = map(int, line.split('x'))