How to create vowel counter in python -
How to create vowel counter in python -
title says all! trying create " display stats" alternative in menu created. display next after inputing sentence. example: string analysis: 6 words 26 characters 9 vowels 17 consonants. made whole word , character counter need vowel , consonants, can help me please? id highly appreciate support!
what got far:
def displayst(): print() print("you said following:") time.sleep(1) length = str(input("please come in sentence: ")) word = dis(length) lengths = diss(length) vowel = disv(length) print(length) time.sleep(1) print() print("string analysis:",'\n', word, "words",'\n', lengths, "characters",'\n',vowel,"vowels",'\n') again()
the vowel = disv(length) need finish , if help consonants great! if not need vowels done consonants guess give seek haha.
then in disv(length):
vowels = 'aeiou' count = {}.fromkeys(vowels,0) char in length: if char in count: count[char] += 1 print(count)
its crazy , havnt clue im going haha. please help cheers.
you not returning disv that's why saying vowels none.you can utilize counter
vowel count
from collections import counter x = counter(length) vowel_count = 0 v in "aeiou": vowel_count += x[v] homecoming vowel_count
this homecoming exact number of vowels in sentence.
python
Comments
Post a Comment