upper()

upper(): All chars changed to Upper case
All chars are changed to upper case letters , no parameter is taken by this method.
my_str='Welcome to plus2net Python section'
output=my_str.upper()
print(output)
Output
WELCOME TO PLUS2NET PYTHON SECTION

Example 1: Handling Empty String with upper()

my_str = ''
output = my_str.upper()
print(output)  # Output: ''
Output:
''

Example 2: Using upper() on String with Mixed Case and Special Characters

my_str = 'Welcome to Plus2Net! @2023'
output = my_str.upper()
print(output)  # Output: 'WELCOME TO PLUS2NET! @2023'
Output:
WELCOME TO PLUS2NET! @2023

Use Case: Converting User Input to Upper Case

user_input = input("Enter your name: ")
print(user_input.upper())
Output:
If input is 'john', output: 'JOHN'
All String methods lower() islower() isupper()


Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer