Added task 3
This commit is contained in:
15
basic programming/3rd task/1.py
Normal file
15
basic programming/3rd task/1.py
Normal file
@@ -0,0 +1,15 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user