Write a function in python to count the number of lines in a text file ‘STORY.TXT’ which is starting with an alphabet ‘A’ .
Answers
Answered by
25
f=open('STORY.TXT','w+')
lines=f.readlines()
#traverse this list and compare the first element of the list with A
count=0
for i in lines:
if i[0][0]=='A':
count+=1
f.close()
i hope this works...
but the logic is correct
Similar questions
English,
5 months ago
Hindi,
5 months ago
Social Sciences,
11 months ago
Math,
11 months ago
Business Studies,
1 year ago
Math,
1 year ago