Python String upper()

The upper() method converts all lowercase characters in a string into uppercase characters and returns it.

Example


Syntax of String upper()

The syntax of upper() method is:

string.upper()

upper() Parameters

upper() method doesn't take any parameters.


upper() Return Value

upper() method returns the uppercase string from the given string. It converts all lowercase characters to uppercase.

If no lowercase characters exist, it returns the original string.


Example 1: Convert a string to uppercase

Output

THIS SHOULD BE UPPERCASE!
TH!S SH0ULD B3 UPP3RCAS3!

Example 2: How upper() is used in a program?

Output

The strings are same.

Note: If you want to convert to lowercase string, use lower(). You can also use swapcase() to swap between lowercase to uppercase.