In python, the string upper() method is useful to convert all the string characters to uppercase. Generally, the upper() method will convert all the lowercase letters in a string to uppercase. In case, if no lowercase letters in a string, it will return the original string.
Following is the pictorial representation of the string upper()
method functionality in python.
If you observe the above diagram, we are trying to convert the given string “Hi guest Hi
” to uppercase using the upper
function in python. The upper()
method has returned the string by converting all the string characters to uppercase.
Following is the syntax of defining a string upper method in python.
The python upper() method will not accept any parameters.
Following is the example of converting the given string characters to uppercase using the string upper()
method in python.
If you observe the above example, we are converting the given string characters to uppercase using the upper()
method.
When you execute the above python program, you will get the result as shown below.
This is how you can use the string upper() method in python to convert all the given string characters to uppercase based on your requirements.