AdventOfCode/2015/day5/part1.py

35 lines
889 B
Python

#!/bin/python3
import sys
from pprint import pprint
input_f = sys.argv[1]
result = 0
with open(input_f) as file:
for line in file:
tmp = line.rstrip()
print(tmp)
vowel_count = 0
t = ['ab','cd','pq','xy']
for i in t:
if tmp.find(i) != -1:
print(tmp + " is naughty because it contains " + i)
break
f = 'aeiou'
go_on = False
for idx,i in enumerate(tmp):
if idx+1 < len(tmp):
#print(idx,idx+1,len(tmp))
if i == tmp[idx+1]:
go_on = True
if f.find(i) != -1:
vowel_count += 1
if vowel_count == 3:
print(tmp + " is nice because it contains " + str(vowel_count) + " vowels and " + i + tmp[idx+1])
#cd, pq, or xy
print()
print(result)