Python string Method - upper()

www.‮aeditfigi‬.com

The upper() method is a built-in string method in Python that returns a copy of a string with all the characters in uppercase.

The syntax for using upper() method is as follows:

string.upper()

Here, string is the original string.

The method returns a new string with all the characters in uppercase.

Here's an example of using the upper() method:

string = "Hello, World!"
upper_string = string.upper()
print(upper_string)

Output:

HELLO, WORLD!

In the example above, the upper() method was used to convert the original string "Hello, World!" to a new string with all the characters in uppercase. The resulting string is stored in the variable upper_string. Note that the original string is not modified by the upper() method.