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  Python code snippet - How to get pygame window height size?

Leave a Reply

Your email address will not be published. Required fields are marked *

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