count lowercase letters python code example

Example 1: how to check if a letter is lowercase in python

for c in s:
    if c.islower():
         print c

Example 2: Count lower case characters in a string

def n_lower_chars(string):
    return sum([int(c.islower()) for c in string])

Example 3: Count upper case characters in a string

def n_upper_chars(string):
    return sum([int(c.isupper()) for c in string])

Example 4: python all lowercase letters

import string
print string.ascii_lowercaseOutputabcdefghijklmnopqrstuvwxyz