def count_capital_letters(x):
    """ Extract number of captial letters in a string """
    try:
        return sum([s.isupper() for s in list(str(x))])
    except Exception as e:
        print(f"Exception raised:\n{e}")
        return 0