Conversion of String Characters to Uppercase in Python
In Python, you can convert all charcters of a string to uppercase using the str.upper()
method.
Converting all characters of a string to uppercase using 'str.upper()' method
1. Create a variable named str_variable
and assign string value "python is a programming language."
to the variable.
2. Apply the upper()
method to the string variable str_variable
. This method converts all characters of the string to uppercase. Store the result in a new variable called upper_string
.
Please take a closer look at the following example:
Example of using upper() method
Output of the above example
PYTHON IS A PROGRAMMING LANGUAGE.