Python program to Get Percentage of Uppercase and Lowercase
str = input("Insert some strings of Uppercase and Lowercase: ")
len_str = len(str)
upper = lower = 0
for i in str:
if 'a' <= i <= 'z':
lower += 1
elif 'A' <= i <= 'Z':
upper += 1
print("Percentage of Uppercase: %.2f %%" % (upper/len_str * 100))
print("Percentage of Lowercase: %.2f %%" % (lower/len_str * 100))
Output:
|
Insert some strings of Uppercase and Lowercase: Insert few Uppercase and Lower case string to find Percentage of case string with Python Programm
Insert some strings of Uppercase and Lowercase: Verify lower Case and Upper case String by Using Python rPogram
|