Python Lab 5
Python Lab 5
Objec ve:
Write a program to read a string and print the total number of upper
case and lower case le ers in it.
So ware/Tools Required:
Python installed from h ps://www.python.org
IDLE (Python's built-in IDE)
Theory:
In Python, uppercase and lowercase le ers play an important role in string
manipula on.
You can change the case of a string using .upper() and .lower(), and check
its case using .isupper() and .islower().
Here's how they work:
1. Changing Case :
Example:
2. Checking Case:
Example:
word = "PYTHON"
print(word.isupper()) # Output = True
word2 = "python"
print(word2.islower()) # Output = True
word3 = "Python"
print(word3.isupper()) # Output = False
print(word3.islower()) # Output = False
Source code:
Uppercase = 0
Lowercase = 0