USING PYHTON 13- the words a , an and the are articles in the English language.W
ID: 3803981 • Letter: U
Question
USING PYHTON
13- the words a , an and the are articles in the English language.Write a function named countArticles() that count both capitalized and lower case instances of articles. input: a list of string each string begin a single word(assume input is valid) and the return; the number of articles in the list
13b- write a function named shortwordCount() using the split method the input is a string (only letters and spaces no punctuaction) and the return the number of words in the string with 3 or fewer letters
20-write a function phonebyInitial() that takes two parameters: a name /phone number dictionary and the second paramter is an initial letter. it should return a dictionary of all names and phone numbers pairs in whih name begins with the given initial
20b- write a function named phonebAreacode() that takes 2 parameters th parameter1 will be the same as the question before and the second paramter will be a three letter string representing an area code
Explanation / Answer
def countArticles(lt):
ans = 0
for item in lt:
item = item.split()
ans+= item.count('a')
ans+= item.count('an')
return ans
l = ['There is an animal','Iam a good guy','aa a an']
an = countArticles(l)
print(an)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.