Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python Program to count the number of lowercase letters and uppercase letters in a string.

string=raw_input("Enter string:")
count1=0
count2=0
for i in string:
      if(i.islower()):
            count1=count1+1
      elif(i.isupper()):
            count2=count2+1
print("The number of lowercase characters is:")
print(count1)
print("The number of uppercase characters is:")
print(count2)
Comment

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
'''

Comment

how to convert lower case to upper case in python

a = "Hello, World!"
print(a.upper())
#output: HELLO, WORLD!
Comment

PREVIOUS NEXT
Code Example
Python :: Get a list of categories of categorical variable (Python Pandas) 
Python :: python sort a 2d array by custom function 
Python :: python tkinter messagebox 
Python :: atan2 of number python 
Python :: get number in string python 
Python :: python loop backward 
Python :: concatenation of array in python 
Python :: python beautifulsoup xpath 
Python :: python print every n loops 
Python :: web driver module in python 
Python :: default values python 
Python :: move column in pandas dataframe 
Python :: python delete key dictionary 
Python :: count number of pages in pdf python pdfminer 
Python :: dataframe number of unique rows 
Python :: how to add a linebreak in python 
Python :: pandas dataframe any along row 
Python :: List comprehension if-else 
Python :: python for loop index 
Python :: binary to octal in python 
Python :: python list contains 
Python :: pyinstaller pymssql 
Python :: append 1 colimn in pandas df 
Python :: how to numbered jupyter notebook 
Python :: how to write a python comment 
Python :: multi threading in python for 2 different functions with return 
Python :: text classification 
Python :: create virtual environment python stack overflow 
Python :: code 
Python :: python gaussian filter 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =