Python Program to Convert lowercase vowel to uppercase

In this Python program tutorial, we will learn to write a program to convert lowercase vowels to uppercase in a given string. We will a String from users as input and check each character in the string. If the character is a lowercase vowel, we will convert it to uppercase. When we checked all characters of the string, will then print the updated string.

For Example:

Input: “hello world” Output: “hEllO wOrld”

Input: “i am coding” Output: “i Am cOdIng”

Convert Lowercase vowels to Uppercase using replace() method

string = input("Enter a string: ")
# define lowercase vowels
vowels = "aeiou"
for char in string:
    if char in vowels:
        # convert the lowercase vowel to uppercase
        upper_char = char.upper()
        # replace the lowercase vowel with the uppercase vowel
        string = string.replace(char, upper_char)
print("Updated string:", string)

Output:

Enter a string: hello world
Updated string: hEllO wOrld

Conclusion:

In this Python program we have learned how to convert all lowercase vowels in a given string to uppercase using replace() methods. Hope you understand this tutorial.