MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/adventofcode/comments/k6qd06/how_not_to_write_an_if_statement/gend3a0/?context=3
r/adventofcode • u/lajoh20 • Dec 04 '20
41 comments sorted by
View all comments
Show parent comment
4
Is there a way to nest for loops in if statements like that so you can cut down on that hair "couler" repetition? Haha
5 u/itsnotxhad Dec 05 '20 something like all(check_passport[4][i] in hair_couler for i in range(1, 6)) 1 u/ItsOkILoveYouMYbb Dec 05 '20 I didn't know about "all()" at all haha, that's really cool. 4 u/[deleted] Dec 04 '20 I guess something like and not bool([check_passport[4][i] not in hair_couler for i in range(1,7)]) would work... why you would do that tho... idk
5
something like all(check_passport[4][i] in hair_couler for i in range(1, 6))
all(check_passport[4][i] in hair_couler for i in range(1, 6))
1 u/ItsOkILoveYouMYbb Dec 05 '20 I didn't know about "all()" at all haha, that's really cool.
1
I didn't know about "all()" at all haha, that's really cool.
I guess something like and not bool([check_passport[4][i] not in hair_couler for i in range(1,7)]) would work... why you would do that tho... idk
and not bool([check_passport[4][i] not in hair_couler for i in range(1,7)])
View all comments
Show parent comment
4
u/ItsOkILoveYouMYbb Dec 04 '20
Is there a way to nest for loops in if statements like that so you can cut down on that hair "couler" repetition? Haha