11 "pi5 = open('advent05.txt').read().strip()"
23 " n1 = len(list(c for c in str if c in \"aeiou\")) >= 3\n",
24 " n2 = any(str[i-1] == str[i] for i in range(1, len(str)))\n",
25 " n3 = all(s not in str for s in ['ab', 'cd', 'pq', 'xy'])\n",
26 " return n1 and n2 and n3 "
44 "output_type": "execute_result"
48 "nice('dvszwmarrgswjxmb')"
66 "output_type": "execute_result"
70 "sum(1 if nice(str.strip()) else 0 for str in pi5.splitlines())"
83 " for i in range(1, len(st)):\n",
84 " if st.find(st[i-1:i+1], i+1) > -1:\n",
88 " return any(st[i-1] == st[i+1] for i in range(1, len(st)-1))\n",
89 " return n1(st) and n2(st)"
105 "execution_count": 6,
107 "output_type": "execute_result"
111 "nice2('ieodomkazucvgmuy')"
116 "execution_count": 7,
124 "['ac', 'bd', 'ce', 'df']"
127 "execution_count": 7,
129 "output_type": "execute_result"
133 "['abcdef'[i-1] + 'abcdef'[i+1] for i in range(1, len('abcdef')-1)]"
138 "execution_count": 8,
149 "execution_count": 8,
151 "output_type": "execute_result"
155 "sum(1 if nice2(st.strip()) else 0 for st in pi5.splitlines())"
160 "execution_count": null,
170 "display_name": "Python 3",
171 "language": "python",
179 "file_extension": ".py",
180 "mimetype": "text/x-python",
182 "nbconvert_exporter": "python",
183 "pygments_lexer": "ipython3",