Skip to content

Commit 0605daa

Browse files
author
Charlotte Weaver
committed
Added solution to lesson 8
1 parent e19aa7f commit 0605daa

2 files changed

Lines changed: 79 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import random
2+
3+
adjectives = {
4+
'A': ['Adorable', 'Awesome', 'Acceptable'],
5+
'B': ['Baggy', 'Bad'],
6+
'C': ['Caluclating', 'Cheerful'],
7+
'D': ['Dimwitted', 'Dull', 'Defiant'],
8+
'E': ['Empty', 'Earnest'],
9+
'F': ['Famous', 'Feisty', 'Filthy'],
10+
'G': ['Greedy', 'Gentle'],
11+
'H': ['Healthy', 'Harsh'],
12+
'I': ['Innocent', 'Infinite', 'Impure'],
13+
'J': ['Joyous', 'Jaded'],
14+
'K': ['Kind', 'Klutzy'],
15+
'L': ['Lazy', 'Likable', 'Little'],
16+
'M': ['Meek', 'Marvelous'],
17+
'N': ['Nice', 'Nocturnal', 'Negative'],
18+
'O': ['Opulent', 'Odd'],
19+
'P': ['Popular', 'Poor', 'Prickly'],
20+
'Q': ['Queasy', 'Quick'],
21+
'R': ['Rude', 'Reasonable', 'Rich'],
22+
'S': ['Scaly', 'Silly', 'Scholarly'],
23+
'T': ['Thick', 'Tepid', 'Tough'],
24+
'U': ['Unruly', 'Unique'],
25+
'V': ['Vapid', 'Virtuous', 'Vital'],
26+
'W': ['Worthless', 'Weak', 'Warm'],
27+
'X': ['Xenophobic'],
28+
'Y': ['Yellowish', 'Young', 'Yummy'],
29+
'Z': ['Zany', 'Zealous']
30+
}
31+
32+
33+
def acrostic(name):
34+
name = name.upper()
35+
for letter in name:
36+
rand_idx = random.randint(0, len(adjectives[letter]) - 1)
37+
current_adj = adjectives[letter][rand_idx]
38+
print "{0}-{1}".format(letter, current_adj)
39+
40+
41+
acrostic('Charlotte')
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
adjectives = {
2+
'A': 'Acceptable',
3+
'B': 'Baggy',
4+
'C': 'Caluclating',
5+
'D': 'Dimwitted',
6+
'E': 'Empty',
7+
'F': 'Filthy',
8+
'G': 'Greedy',
9+
'H': 'Harsh',
10+
'I': 'Impure',
11+
'J': 'Jaded',
12+
'K': 'Klutzy',
13+
'L': 'Lazy',
14+
'M': 'Meek',
15+
'N': 'Negative',
16+
'O': 'Odd',
17+
'P': 'Prickly',
18+
'Q': 'Queasy',
19+
'R': 'Rude',
20+
'S': 'Scaly',
21+
'T': 'Thick',
22+
'U': 'Unruly',
23+
'V': 'Vapid',
24+
'W': 'Worthless',
25+
'X': 'Xenophobic',
26+
'Y': 'Yellowish',
27+
'Z': 'Zany'
28+
}
29+
30+
31+
def acrostic(name):
32+
name = name.upper()
33+
for letter in name:
34+
current_adj = adjectives[letter]
35+
print "{0}-{1}".format(letter, current_adj)
36+
37+
38+
acrostic('Charlotte')

0 commit comments

Comments
 (0)