def analyzeString(text): # Vrať str s počtem samohlásek, souhlásek, čísel a ostatních znaků v textu countVowels, countConsonant, countNumbers, countOthers = 0, 0, 0, 0 vowels = "aáeéěiíoóuúůyý" consonant = "bcčdďfghjklmnňpqrřsštťvwxzž" numbers = "0123456789" # variant 1 """ for i in range(len(text)): print(text[i]) """ # variant 2 for character in text.lower(): if character in vowels: countVowels += 1 elif character in consonant: countConsonant += 1 elif character in numbers: countNumbers += 1 else: countOthers +=1 return "Samohlásky: " + str(countVowels) + "\n" + "Souhlásky: " + str(countConsonant) + "\n" + "Čísla: " + str(countNumbers) + "\n" + "Ostatní: " + str(countOthers) + "\n" print(analyzeString("Právě se nacházíte v učebně 6.")) print(analyzeString("Druhý text, aby byl jiný."))