Finished 2015-12-05 part 1
This commit is contained in:
parent
ca14013b36
commit
6d90ad5b41
1000
2015/day5/input
Normal file
1000
2015/day5/input
Normal file
File diff suppressed because it is too large
Load Diff
@ -10,25 +10,31 @@ result = 0
|
|||||||
with open(input_f) as file:
|
with open(input_f) as file:
|
||||||
for line in file:
|
for line in file:
|
||||||
tmp = line.rstrip()
|
tmp = line.rstrip()
|
||||||
print(tmp)
|
print(tmp)
|
||||||
vowel_count = 0
|
vowel_count = 0
|
||||||
t = ['ab','cd','pq','xy']
|
t = ['ab','cd','pq','xy']
|
||||||
|
first = False
|
||||||
|
second = False
|
||||||
for i in t:
|
for i in t:
|
||||||
if tmp.find(i) != -1:
|
if tmp.find(i) != -1:
|
||||||
print(tmp + " is naughty because it contains " + i)
|
print(" is naughty because it contains " + i)
|
||||||
|
first = True
|
||||||
break
|
break
|
||||||
f = 'aeiou'
|
f = 'aeiou'
|
||||||
go_on = False
|
|
||||||
for idx,i in enumerate(tmp):
|
for idx,i in enumerate(tmp):
|
||||||
if idx+1 < len(tmp):
|
if idx+1 < len(tmp) and first == False:
|
||||||
#print(idx,idx+1,len(tmp))
|
#print(idx,idx+1,len(tmp))
|
||||||
if i == tmp[idx+1]:
|
if i == tmp[idx+1]:
|
||||||
go_on = True
|
second = True
|
||||||
if f.find(i) != -1:
|
if second == False and first == False:
|
||||||
|
print("naughte cus no double")
|
||||||
|
for idx,i in enumerate(tmp):
|
||||||
|
if f.find(i) != -1 and second == True and first == False:
|
||||||
vowel_count += 1
|
vowel_count += 1
|
||||||
if vowel_count == 3:
|
if vowel_count == 3:
|
||||||
print(tmp + " is nice because it contains " + str(vowel_count) + " vowels and " + i + tmp[idx+1])
|
print(" is nice because it contains " + str(vowel_count) + " vowels and double letters")
|
||||||
|
result += 1
|
||||||
#cd, pq, or xy
|
if second == True and vowel_count < 3:
|
||||||
|
print("naughty cus " + str(vowel_count) + " vowels")
|
||||||
print()
|
print()
|
||||||
print(result)
|
print(result)
|
||||||
|
Loading…
Reference in New Issue
Block a user