-
Notifications
You must be signed in to change notification settings - Fork 1
/
STUDY THIS CODE.py
35 lines (22 loc) · 1.13 KB
/
STUDY THIS CODE.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
26
27
28
29
30
31
32
33
34
35
STUDY THIS CODE
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 poem in highlighted_poems_list:
highlighted_poems_stripped.append(poem.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 poem in highlighted_poems_details:
titles.append(poem[0])
poets.append(poem[1])
dates.append(poem[2])
for i in range(0,len(highlighted_poems_details)):
print('The poem {} was published by {} in {}'.format(titles[i], poets[i], dates[i]))