Created
May 4, 2021 18:18
-
-
Save eliteops/0a6860fb0a39680ffece1dd59602675a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ighlighted_poems = "Afterimages:Audre Lorde:1997, The Shadow:William Carlos Williams:1915, Ecstasy:Gabriela Mistral:1925, Georgia Dusk:Jean Toomer:1923, Parting Before Daybreak:An Qi:2014, The Untold Want:Walt Whitman:1871, Mr. Grumpledump's Song:Shel Silverstein:2004, Angel Sound Mexico City:Carmen Boullosa:2013, In Love:Kamala Suraiyya:1965, Dream Variations:Langston Hughes:1994, Dreamwood:Adrienne Rich:1987" | |
#print(highlighted_poems) | |
highlighted_poems_list = highlighted_poems.split(',') | |
#print(highlighted_poems_list) | |
highlighted_poems_stripped = [] | |
for poems in highlighted_poems_list: | |
highlighted_poems_stripped.append(poems.strip(', ')) | |
#print(highlighted_poems_stripped) | |
highlighted_poems_details = [] | |
for poem in highlighted_poems_stripped: | |
highlighted_poems_details.append(poem.split(':')) | |
#print(highlighted_poems_details) | |
titles = [] | |
poets = [] | |
dates = [] | |
for poema in highlighted_poems_details: # you can take anything instead of poema | |
titles.append(poema[0]) | |
poets.append(poema[1]) | |
dates.append(poema[2]) | |
for i in range(len(titles)): | |
print(f'The poem {titles[i]} was published by {poets[i]} in {dates[i]}.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment