Skip to main content

Command Palette

Search for a command to run...

Upper Case Function in Python

Published
1 min readView as Markdown
Upper Case Function in Python
A

I am a Tech enthusiast interested to learn new things from everyone and post my learning in public.

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()
#input and output:
is_upper_case('ABC') # True
is_upper_case('a3@$') # False
is_upper_case('aB4') # False