-4
DEF countLetters(計數):我不知道這個Python代碼有什麼問題,但它說「預計一個縮進塊」?
letterList = []
在計數字母: 如果信不在letterList: letterList.append(字母)
返回letterList
詞語= open(「/ Users/Sammi/Desktop/Hw3_nanisama/words.txt」,「r」)
print(words)
打印( 「文件長度:」,LEN(字))
打印( 「一」,LEN(aCount))
打印( 「B:」,LEN(bCount))
的emptyList =名單()
讀一本Python書... –
[Python期望的縮進塊錯誤]的可能重複(http://stackoverflow.com/questions/12632615/python-expected-an-indented-block-error) – miradulo
Python是[偏移規則](https: //en.wikipedia.org/wiki/Off-side_rule)語言,從而定義帶有縮進的代碼塊。這段代碼沒有正確縮進。 –