-
Notifications
You must be signed in to change notification settings - Fork 0
/
012Strings2.py
25 lines (20 loc) · 1.05 KB
/
012Strings2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
highlighted_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 i in highlighted_poems_list:
highlighted_poems_stripped.append(i.strip())
print(highlighted_poems_stripped)
highlighted_poems_details = []
for i in highlighted_poems_stripped:
highlighted_poems_details.append(i.split(":"))
titles = []
poets = []
dates = []
for info in highlighted_poems_details:
titles.append(info[0])
poets.append(info[1])
dates.append(info[2])
for i in range(len(highlighted_poems_details)):
print("The poem {} was published by {} in {}".format(titles[i], poets[i], dates[i]))