Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created January 11, 2021 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/e33a60dd446600bf1116f32ca4a2bad7 to your computer and use it in GitHub Desktop.
Save codecademydev/e33a60dd446600bf1116f32ca4a2bad7 to your computer and use it in GitHub Desktop.
Codecademy export
authors = "Audre Lorde,Gabriela Mistral,Jean Toomer,An Qi,Walt Whitman,Shel Silverstein,Carmen Boullosa,Kamala Suraiyya,Langston Hughes,Adrienne Rich,Nikki Giovanni,"
author_names = authors.split(",")
print(author_names)
#I want to add names between a space and a comma and include the last names at beginning and end.
author_last_names = []
for i in range(0, len(authors)):
if authors[i] == " ":
space = i
elif authors[i] == ",":
comma = i
author_last_names.append(authors[space+1:comma])
print(author_last_names)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment