Skip to content

Commit 6d0f198

Browse files
Day 6
1 parent 07b9680 commit 6d0f198

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

Day 6/day_6_bonus.py

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import datetime
2+
3+
4+
default_names = ["Justin", "john", "Emilee", "Jim", "Ron", "Sandra", "veronica", "Whitney"]
5+
default_amounts = [123.32, 94.23, 124.32, 323.4, 23, 322.122323, 32.4, 99.99]
6+
7+
unf_message = """Hi {name}!
8+
9+
Thank you for the purchase on {date}.
10+
We hope you are exicted about using it. Just as a
11+
reminder the purcase total was ${total}.
12+
Have a great one!
13+
14+
Team CFE
15+
"""
16+
17+
18+
def make_messages(names, amounts):
19+
messages = []
20+
if len(names) == len(amounts):
21+
i = 0
22+
today = datetime.date.today()
23+
text = '{today.month}/{today.day}/{today.year}'.format(today=today)
24+
for name in names:
25+
"""
26+
Here's a simple solution to capitalize
27+
everyone's name prior to sending
28+
"""
29+
name = name[0].upper() + name[1:].lower()
30+
31+
"""
32+
Did you get the bonus??
33+
"""
34+
35+
new_amount = "%.2f" %(amounts[i])
36+
new_msg = unf_message.format(
37+
name=name,
38+
date=text,
39+
total=new_amount
40+
)
41+
i += 1
42+
print(new_msg)
43+
44+
45+
46+
make_messages(default_names, default_amounts)

Day 6/day_6_end.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import datetime
2+
3+
4+
default_names = ["Justin", "john", "Emilee", "Jim", "Ron", "Sandra", "veronica", "Whitney"]
5+
default_amounts = [123.32, 94.23, 124.32, 323.4, 23, 322.122323, 32.4, 99.99]
6+
7+
unf_message = """Hi {name}!
8+
9+
Thank you for the purchase on {date}.
10+
We hope you are exicted about using it. Just as a
11+
reminder the purcase total was ${total}.
12+
Have a great one!
13+
14+
Team CFE
15+
"""
16+
17+
18+
def make_messages(names, amounts):
19+
messages = []
20+
if len(names) == len(amounts):
21+
i = 0
22+
today = datetime.date.today()
23+
text = '{today.month}/{today.day}/{today.year}'.format(today=today)
24+
for name in names:
25+
new_amount = "%.2f" %(amounts[i])
26+
new_msg = unf_message.format(
27+
name=name,
28+
date=text,
29+
total=new_amount
30+
)
31+
i += 1
32+
print(new_msg)
33+
34+
35+
36+
make_messages(default_names, default_amounts)

Day 6/day_6_start.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
names = ["Justin", "john", "Emilee", "Jim", "Ron", "Sandra", "veronica", "Whitney"]
2+
amounts = [123.32, 94.23, 124.32, 323.4, 23, 322.122323, 32.4, 99.99]
3+
4+
message = """Hi there!
5+
6+
Thank you for the purchase on May 5th 2016.
7+
We hope you are exicted about using it. Just as a
8+
reminder the purcase total was $199.99.
9+
Have a great one!
10+
11+
Team CFE
12+
"""

0 commit comments

Comments
 (0)