Python program with user define function

Python program with user define function

Python program with user define function that accept a string as a parameter and replace all vowels in the string with “*”.

Solution :

def replace_vowels(input_string):
    result = ""
    for char in input_string:
        if char in 'aeiouAEIOU':
            result += '*'
        else:
            result += char
    return result

# Get user input
user_input = input("Enter a string: ")

# Call the function and display the result
print("Modified string:", replace_vowels(user_input))