Computer Science Python Programs
Computer Science Python Programs
Question :
Write a program using functions to 1. count the number of vowels 2. Search for a character 3.
Display the occurrence of a character, in a string passed as argument to it.
Output :
def count_vowels(s):
count = 0
for char in s:
if char in 'aeiouAEIOU':
count += 1
return count
if search_character(string, character):
print(f"The character '{character}' is found in the string.")
else:
print(f"The character '{character}' is not found in the string.")