Files
30-seconds-of-code/snippets/is_upper_case.md
2018-03-08 12:02:57 +05:30

331 B

is_upper_case

Checks if a string is upper case.

Convert the given string to upper case, using str.upper() method and compare it to the original.

def is_upper_case(string):
    return string == string.upper()
is_upper_case('ABC') # True
is_upper_case('a3@$') # True
is_upper_case('aB4') # False