-1
from collections import Counter
Astring = input("Enter a word or sentence: ")
vowel = 'a' 'e' 'i' 'o' 'u'
Astring = Counter(c for c in Astring.lower() if c in vowel)
min_values = {mainv: Astring[mainv] for mainv in Astring if Astring[mainv] == min(Astring.values())}
if vowel not in Astring:
print ("your text must contain vowels")
else:
print("The least occuring vowel is:")
for m in min_values:
print("{vowel} with {occ} occurences.".format(vowel=m, occ=min_values[m]))
我希望我的代碼輸出在此之上的最低發生元音我想一個錯誤檢查,以確保該字符串在元音輸入它我想一個錯誤檢查,以確保該字符串有元音輸入
你有什麼問題? –
我想要進行錯誤檢查以確保輸入確實包含元音 – MasankoX25
這不是問題,而是目標。 –