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()


Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



Subscribe to our YouTube Channel here



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 Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer