Answers for "get uppercase and lowercase letters python"

11

converting capital letters to lowercase and viceversa in python

s=input()
new_str=""
for i in range (len(s)):
    if s[i].isupper():
        new_str+=s[i].lower()
    elif s[i].islower():
        new_str+=s[i].upper()
    else:
        new_str+=s[i]
print(new_str)
Posted by: Guest on April-11-2020
1

string upper lower count python

# count uppercase,lowercase,digits and special characters.
a=input('enter the string:')
u=l=d=s=0
for i in a :
    if i.isupper():
        u+=1
    elif i.islower():
        l+=1
    elif i.isdigit():
        d+=1
    else:
        s+=1
print('if the string is upper',u)
print('if the string is lower',l)
print('if the string is digit',d)
print('if the string is special',s)

#output:
'''
enter the string: 'Hii Buddy! How Have You BEEN , Welcome To PYTHON....
if the string is upper 17
if the string is lower 20
if the string is digit 0
if the string is special 17
'''
Posted by: Guest on January-20-2022

Code answers related to "get uppercase and lowercase letters python"

Python Answers by Framework

Browse Popular Code Answers by Language