Python upper

The Python upper function is used to convert the given string into Uppercase letters and return a new string. The syntax of the string upper Function in Python Programming for the uppercase string is

String_Value.upper()

TIP: The String upper Function keep the Non-letters unchanged.

Python upper method Example

The following examples help us to learn the upper Function. Alternatively, say, this Python program converts the specified string to uppercase.

# Python Uppercase Method Example

Str1 = 'Learn PYTHON AT TutOrial Gateway'
Str2 = Str1.upper()
print('First Output of an Upper() method is = ', Str2)

# Observe the Original String
print('Converted String is = ', Str1.upper())
print('Original String is = ', Str1)

# Performing upper() function directly
Str3 = 'PYTHON ProGramming'.upper()
print('Second Output of an Upper() method is = ', Str3)

Str4 = 'python1234TutorIal'.upper()
print('Third Output of an Upper() method is = ', Str4)

Str5 = '12345'.upper()
print('Fourth Output of an Upper() method is = ', Str5)
Python Upper

Within this Python uppercase example, first, we declared the String variable Str1 and assigned a corresponding value using the following statement

Str1 = 'Learn PYTHON AT Tutorial GateWay'

The following statement converts the above string into Uppercase using Python upper function and prints the output

Str2 = Str1.upper()
print('First Output of an Upper() method is = ', Str2)

The uppercase function in Python returns the output in a new string.

print('Converted String is = ', Str1.upper())
print('Original String is = ', Str1)

Use the below Python function code to change the original String.

Str1 = Str1.upper()

The Python Uppercase function only converts the characters to Uppercase and leave others unchanged. Within the below upper String function code, we used the numeric values along with letters, and see the output.

Str4 = 'python1234TutorIal'.upper()
print('Third Output of an Upper() method is = ', Str4)

Str5 = '12345'.upper()
print('Fourth Output of an Upper() method is = ', Str5)