Skip to content

Instantly share code, notes, and snippets.

@jlewin
Created March 2, 2020 18:39
Show Gist options
  • Save jlewin/32cb5520b9a9d1c92f2f0e3e3df5d2ae to your computer and use it in GitHub Desktop.
Save jlewin/32cb5520b9a9d1c92f2f0e3e3df5d2ae to your computer and use it in GitHub Desktop.
def count_upper_words(str):
words = str.split(' ');
print('\n\n---- %s ----' % str)
return sum([word.isupper() for word in words])
print(count_upper_words('Fast'))
print(count_upper_words('SLOW'))
print(count_upper_words('first MIDDLE Last'))
print(count_upper_words('first MIDDLE LAST'))
print(count_upper_words('FIRST MIDDLE LAST'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment