寫法 一text=input("text: ")count=0for i in text: if i.isalpha(): count=count+1print(count)寫法 二text=input("text: ")count=sum(1 for char in text if char.isalpha())print(count)