推 Django: for num in word.lower(): if num in 'aeiou': count += 111/03 17:38
→ Django: (請自行排版) 另外你本來的寫法是錯的,aeiou的值沒有累加11/03 17:39
抱歉我打錯了!!!是要問有幾種母音
推 johnlinvc: import re11/03 17:47
→ johnlinvc: count=len(re.findall("[AEIOU]", word,re.I))11/03 17:48
※ 編輯: tnzikom (140.112.25.99), 11/03/2017 18:29:08
→ NTUGG: str.count(....) 11/03 18:35
推 Yshuan: [ch in word.lower() for ch in 'aeiou'].count(True) 11/03 21:22
→ Yshuan: num in word.lower() #小寫的word是否有num變數代表的字母 11/03 21:24
→ bibo9901: len( set("aeiou") & set(word) ) 11/03 22:44
→ goldflower: word='ptT is Back' for num in word作用如同 11/03 23:27
→ goldflower: for num in ['p','t','t',' ','i','s',' ',......] 11/03 23:28
→ lance8537: 感覺好leetcode 11/05 11:08