Menu Close

Python String upper() Method

python string upper

In this article, you will learn about the Python string upper() method along with some examples.
The python string upper method is used to convert all lowercase to uppercase and returns a new uppercased string.

In the previous tutorial, we have seen the Python string lower() method to convert uppercase to lowercase.

Python String upper Method

Python upper() string method is used to convert all the lowercase characters to uppercase characters and return a new uppercased string.

Syntax

The syntax of the upper function in the python method is:-

string.upper()

Parameter

upper function in python does not take any parameter.

Return Value

The upper function in python returns a new uppercased string from the given string.it converts all the lowercase characters to uppercase.

Example

Here we will take different examples of the string upper() method.

Example 1:

#convert 'programming' string to uppercase
a = 'programming'
result = a.upper()
print(result)

The output will be:- ‘PROGRAMMING

Example 2:

#convert 'Programming FUNDA' string to uppercase
a = 'Programming FUNDA'
result = s.upper()
print(result)

The output will be:- PROGRAMMING FUNDA

Example 3:

#convert each item of the list in uppercae and iterate through for loop
a = ['Python','java','c','php']
for i in a:
	print(i.upper())

Output:

PYTHON
JAVA
C
PHP

Conclusion:

In this tutorial, you have learned all about the Python string upper() method to convert all the lowercase characters to uppercase characters. If you want to convert any lowercase to upper case, Then this is the best string method for you.
I hope this tutorial will help you. If you like this article, please share it with your friends who want to learn Python.

Other string methods


For More Information: Click Here

Python String isalpha() Method
Python String islower() Method

Related Posts