Your boss at the Poetry organization sent over a bunch of author names that he wants you to prepare for importing into the database. Annoyingly, he sent them over as a long string with the names separated by commas.
.split() and the provided string, create a list called
author_names containing each individual author name as it’s own string.
Checkpoint 2 Passed
Great work, but now it turns out they didn’t want poet’s first names (why didn’t they just say that the first time!?)
Create another list called
author_last_names that only contains the last names of the poets in the provided string.
this how i went about mine.
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(’,’)
names = [name.split() for name in author_names]
this is for the second one.
author_last_names = [last_name[-1] for last_name in names]