33 lines
643 B
Python
33 lines
643 B
Python
|
def is_word(word):
|
||
|
counter = 0
|
||
|
for l in word:
|
||
|
if (counter % 2) == 0: #zero is vowel, one is constanant
|
||
|
if l == 'a' or l == 'e' or l == 'i' or l == 'o' or l == 'u':
|
||
|
counter = counter + 1
|
||
|
else:
|
||
|
return False
|
||
|
else:
|
||
|
if l == 'b' or l == 'k' or l == 'p' or l == 't' or l == 'z':
|
||
|
counter = counter + 1
|
||
|
else:
|
||
|
return False
|
||
|
return True
|
||
|
|
||
|
def cycle(lst):
|
||
|
while True:
|
||
|
yield lst
|
||
|
x = lst[0]
|
||
|
lst = lst[1:]
|
||
|
lst.append(x)
|
||
|
|
||
|
class Skippy:
|
||
|
def __init__(self, lst, offset)
|
||
|
self.lst = lst
|
||
|
self.offset = offset
|
||
|
self.counter = 0
|
||
|
|
||
|
def __next__(self)
|
||
|
if self.counter > length(self.lst)
|
||
|
self.counter = 0
|
||
|
|