s = str(input("Please enter your line of text: ").lower())
only_vowels = re.sub(r"[^aeiou]", "", s)
c = (Counter(list(only_vowels)))
print(c)
if len(c) >= 1:
most = c.most_common()[-1]
result = (most[0])
i = -2
if len(c)>=2:
while (c.most_common()[i][1]) == most[1]:
result = ", ".join((result, c.most_common()[i][0]))
i = i-1
print("The least common vowel(s) in the inserted sentence is/are", (result),"and it/they appear(s)",most[1],"times.")
else:
print("You have not inserted any vowels into this sentence.")
は
コードは、コードのこの作品に出トリップ 'しばらく(c.most_common()[I] [1])==最も[1]:'ループリストインデックスが範囲外ですが、意味がありませんか?
任意のアイデアなぜですか?
'c'は' Counter'です。 –
'c'や' most'変数の定義や、このスニペットの前にどのように使われているかなど、もっと多くのコンテキストを知らなくても、この問題を理解することは難しいでしょう。 – wilkesybear
元の質問を確認してください。問題は私のカウンター機能が機能していないことに気づいた。この問題を解決する方法はありますか(オリジナルQ編集済み) –