Ad

Returns true if the sentence is every letter in it is Capital.

It wil also return true if there is no letter inside.

HELLO
IM YELLING
1234
!!

Are examples.

def AmIYelling(input_sentence):
    return len([l for l in input_sentence if ((l.isalpha() and l.isupper())or not l.isalpha())]) == len(input_sentence)

Inside a list of words, return the longest of them.

def getLongestWord(words):
    longest = ""
    for w in words:
        longest = w if len(w) > len(longest) else longest
    return longest