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
Percentage of Uppercase: 6.19 %
Percentage of Lowercase: 78.35 %

 

Insert some strings of Uppercase and Lowercase: Verify lower Case and Upper case String by Using Python rPogram
Percentage of Uppercase: 11.11 %
Percentage of Lowercase: 73.02 %

 

Subscribe For Daily Updates

100+ Python Pattern Examplespython pattern examples - star patterns, number patterns