Generation

generate functionTue, 28 Feb 2023

• Write a program in python that takes natural language (a to z) or (A to Z) which contains at least one vowel. If the entered word by the user doesn’t contain a vowel print ‘Invalid String’.

def count_vowels(string): vowel_count = 0 for char in string: if char.lower() in "aeiou": vowel_count += 1 return vowel_count vowel = input("enter a string : ") print(count_vowels(vowel))

Questions about programming?Chat with your personal AI assistant