Python upper

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

String_Value.upper()

TIP: It keeps 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.

# Uppercase Method Example

Str1 = 'Learn PYTHON AT TutOrial Gateway'
Str2 = Str1.upper()
print('First Output  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  is = ', Str3)

Str4 = 'python1234TutorIal'.upper()
print('Third Output  is = ', Str4)

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

Within this example, 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 Python string uppercase function returns the output in a new one.

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

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

Str1 = Str1.upper()

This method only converts the characters to Uppercase and leaves others unchanged. Within the below upper function code, we used the numeric values along with letters, and see the output.

Str4 = 'python1234TutorIal'.upper()
print('Third Output is = ', Str4)

Str5 = '12345'.upper()
print('Fourth Output is = ', Str5)