हिंदी

Write a function, vowelCount() in Python that counts and displays the number of vowels in the text file named Poem.txt.

Advertisements
Advertisements

प्रश्न

Write a function, vowelCount() in Python that counts and displays the number of vowels in the text file named Poem.txt.

टिप्पणी लिखिए
Advertisements

उत्तर

def vowelCount ():
           fObj = open("Alpha.txt","r")
           data = str(fObj.read())
           cnt=0
           for ch in data:
                    if ch in "aeiouAEIOU":
                            cnt=cnt+1
           print (cnt)
           fObj .close()
shaalaa.com
Reading from a Text File in Python
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2023-2024 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×