Advertisement
# Signature of upper() method
upper()
# Python - Method upper() Example
# Creating a string
s1 = ('Czech Republic')
# Printing the original string
print('Value of string : ', s1)
# Calling the upper() method on string object
print('Calling the upper() method on string : ', s1.upper())
Value of string : Czech Republic
Calling the upper() method on string : CZECH REPUBLIC
# Python - Method upper() Example
# Creating a string
s1 = ('Pluto - A dwarf planet')
# Printing the original string
print('Original string before calling upper() : ', s1)
# Calling the upper() method on string object
print('Calling the upper() method : ', s1.upper())
# Printing the original string
print('Original string after calling upper() : ', s1)
String's value : Pluto - A dwarf planet
Calling the upper() method : PLUTO - A DWARF PLANET
Original string after calling upper() - Pluto : A dwarf planet
Advertisement
# Python - upper() method example.
# Creating a string
s = 'you have got to live your life!'
# Printing the original string
print('Original string is : ', s)
# Result of calling upper() is made to reference by the reference of original string.
s= s.upper()
# Old reference variable pointing to the new string
print('String value after upper() : ', s)
Original string value : you have got to live your life!
String value after upper() : YOU HAVE GOT TO LIVE YOUR LIFE!
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement