-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
这不是问题,而是目标。 –