Write a Python function that accepts a string and calculate the number of upper case letters and lower case letters. I have used python 3.7 compiler for debugging purpose.
def string_test(str): d={"UPPER_CASE":0, "LOWER_CASE":0} for c in str: if c.isupper(): d["UPPER_CASE"]+=1 elif c.islower(): d["LOWER_CASE"]+=1 else: pass print ("Original String : ", str) print ("No. of Upper case characters : ", d["UPPER_CASE"]) print ("No. of Lower case Characters : ", d["LOWER_CASE"]) string_test('TechStudy - The Complete Debugging Solution')
27 July 2019 2320 Written By: Rohit
© 2020 Tech Study. All rights reserved | Developed by Tech Study| Privacy Policy | Sitemap