Counting Upper and Lower

    0

    0

    Mahendra Kumar

    beginnerstrings

    Python program to count uppercase and lowercase characters

    # take input
    string = input('Enter any string: ')
    upper, lower = 0, 0
    for i in string:
        #count lowercase characters
        if(i.islower()):
            lower = lower + 1
        #count uppercase characters
        elif(i.isupper()):
            upper = upper + 1
    # print number of lowercase characters
    print('Lowercase characters:',lower)
    # print number of uppercase characters
    print('Uppercase characters:',upper)
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.