Python string upper() method

Python String upper() Method

Description

The upper() method returns a copy of a string with all case-based characters converted to uppercase.

Syntax

The following is the syntax of the upper() method:

var.upper()

Parameters

None

Return Value

This method returns a copy of a string with all case-based characters converted to uppercase.

Example

The following example demonstrates the use of the upper() method.

var = "this is string example....wow!!!"
var1 = var.upper()

print ("original string:", var)
print ("Upper case:", var1)

When you run this program, it will produce the following output:

original string: this is string example....wow!!!
Upper case: THIS IS STRING EXAMPLE....WOW!!!

Leave a Reply

Your email address will not be published. Required fields are marked *