16 lines
423 B
Python
16 lines
423 B
Python
def countAlphaBet(txt: str) -> int:
|
|
count = 0
|
|
for char in txt:
|
|
if char.isalpha(): # בודק אם התו הוא אות
|
|
count += 1
|
|
return count
|
|
|
|
def main_1ex():
|
|
txt1 = "Hello World!"
|
|
print(f'in {txt1} there are {countAlphaBet(txt1)} alphabetic characters')
|
|
|
|
txt2 = "123 test 123 test"
|
|
print(f'in {txt2} there are {countAlphaBet(txt2)} alphabetic characters')
|
|
|
|
main_1ex()
|