• Python

    Count Word, Line, Words Start From Vowel From File Python

    Write a python program that reads the contents of the file poem.txt and count the number of alphabets blank spaces lowercase letters and uppercase letters the number of words starting from vowel and the number of occurrences of each word in the file. alphabet=0 space=0 lower=0 upper=0 voword=0 oc=0 occur={} f=open("data.txt","r") content=f.read() vowel=['a','e','i','o','u','A','E','I',"O",'U'] print("Contet Of File") print(content) print("\nTotal Length Of File",len(content)) words=content.split(' ') #print(words) for i in range(len(content)): #print(content[i]) if (content[i]>='a' and content[i]<='z') or (content[i]>='A' and content[i]<='Z'): lower+=1 alphabet+=1 if content[i]>='A' and content[i]<='Z': upper+=1 if(content[i]==' '): space+=1 for i in range(len(words)): str=words[i] oc=0 if str[0] in vowel: voword+=1 for j…