Skip to content

Check if given string is in uppercase or lowercase in Python

Advertisements
# Check if a given string is upper case.
def is_string_uppercase(your_string):
    return your_string.isupper()
  
 
# Check if a given string is lower case.
def is_string_lowercase(your_string):
    return your_string.islower()


def main():
    # Check if a given string is upper case.
    print(is_string_uppercase("POOPCODE!"))
    # Check if a given string is lower case.
    print(is_string_uppercase("poopcode!"))


main()

See also  How to split a string into a list of characters in Python?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.