Tatsächlich war es mir nicht so recht bewusst, dass der code doch sehr fehlerhaft ist.
Ich habe nochmal nachgerüstet und außer dem stillen "h" und der Groß - und Kleinschreibung alles behoben. ( Das Letztere ist ja acuh nicht erklärt. )
Python-Code
""" pig latin """
# https://de.wikipedia.org/wiki/Konsonantencluster
Konsonaten_cluser = 'qu, bl, br, ch, chl, chr, dr, dw,fl, fr, gl, gn, gr,kh, khm, kl, kn, kr, pf, pfl, pfr, pl, pn, pr, ps, ph, phl, phr, rh, sk, skl, skr, sl, sp, sph, spl, spr, st, str, sz, sch, schl, schm, schn, schr, schw, th, thr, tr, vl ,wr, zw'.split(', ')
vocals = 'a, e, u, o, i, h'.split(', ')
words = 'loser, button, star, three, question, happy, Pig, Latin, eagle, honour, america'.lower().split(', ')
def check_konsonaten(word):
for length in range(4,1,-1):
for item in Konsonaten_cluser:
if item == word[:len(item)] and len(item) == length:
return item
for word in words:
kons = check_konsonaten(word)
if word[:1] in vocals:
print(word.title() + '-' +'ay')
elif kons:
print (word[len(kons):].title()+'-' + kons + 'ay')
else:
print(word[1:].title() + '-' + word[0]+'ay')