Skip to content

Instantly share code, notes, and snippets.

@gtokman
Created November 30, 2016 23:02
Show Gist options
  • Save gtokman/9b11a3e3b1b30290ce90fe30ff5393b5 to your computer and use it in GitHub Desktop.
Save gtokman/9b11a3e3b1b30290ce90fe30ff5393b5 to your computer and use it in GitHub Desktop.
# Given a String
example_string = "Hello Welcome to New York City"
def find_capitals(words):
capitals = list()
for letter in list(words):
# Determine the letters that are capital case
if letter.isupper():
# put them into an array
capitals.append(letter)
# order alpha
capitals.sort()
return capitals
capitals = find_capitals(example_string)
print(capitals)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment