TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Python String | upper() method with Examples

Python String upper() method with Examples on capitalize(), center(), count(), encode(), find(), format(), index(), join(), lower(), ljust(), isupper(), istitle(), isspace(), isprintable(), isnumeric(), islower() etc.

<< Back to PYTHON

Python String upper() Method

Python upper() method converts all the character to uppercase and returns a uppercase string.

Signature

upper()

Parameters

No parameters

Return

It returns a string.

Let's see some examples of upper() method to understand it's functionality.

Python String upper() Method Example 1

First see a simple example of upper() method. This method returns a uppercase string.

# Python upper() method 
# Declaring table and variables
str = "Hello TheDeveloperBlog"
# Calling function
str2 = str.upper()
# Displaying result
print(str2)

Output:

HELLO JAVATPOINT

Python String upper() Method Example 2

See, how can we use this method in programming. The below example converts all the elements of the list into uppercase. See the example.

# Python upper() method 
# Declaring variables
list = ["irfan","sohan","mohan"]
for  l in list:
    print(l.upper()) # Displaying result

Output:

 IRFAN
SOHAN
MOHAN

Python String upper() Method Example 3

An example that converts all the string into uppercase which starts with vowels. See the example below.

# Python upper() method 
# Declaring variables
names = ["irfan","sohan","aman","mohan"]
vowels = ['a','e','i','o','u']
for  l in names:
    for v in vowels:
        if(l.startswith(v)):
            print(l.upper()) # Displaying result

Output:

IRFAN
AMAN

Next TopicPython Strings




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf