QUESTION DATED : 28/11/2024

(Question Code : QC24112800)

  A PYTHON FUNCTION THAT TAKES A STRING AS A INPUT AND RETURNS THE TOTAL NUMBER OF VOWELS (BOTH LOWERCASE AND UPPERCASE) IN THE STRING.  


      ANSWER

def count_vowels(a):

 vowels = ('a','e','i','o','u','A','E','I','O','U')

 count = 0

 for i in a:

     if(i in vowels):

         count = count + 1

 return count


a = input(" enter the sentence :")

print (count_vowels(a))


                                                                    


No comments:

Post a Comment

APPLICATIONS

Support Us Help us create more useful apps! We've already built a screen recorder(availabe in APPS...