-
Notifications
You must be signed in to change notification settings - Fork 0
/
py_day_test.py
82 lines (73 loc) · 2.29 KB
/
py_day_test.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import datetime
class MessageUser():
user_details = []
messages = []
base_message = """Hi {name}!
Thank you for the purchase on {date}.
We hope you are exicted about using it. Just as a
reminder the purcase total was ${total}.
Have a great one!
Team CFE
"""
def add_user(self, name, amount, email=None):
name = name[0].upper() + name[1:].lower()
amount = "%.2f" %(amount)
detail = {
"name": name,
"amount": amount,
}
today = datetime.date.today()
date_text = '{today.month}/{today.day}/{today.year}'.format(today=today)
detail['date'] = date_text
if email is not None: # if email != None
detail["email"] = email
self.user_details.append(detail)
def get_details(self):
return self.user_details
def make_messages(self):
if len(self.user_details) > 0:
for detail in self.get_details():
name = detail["name"]
amount = detail["amount"]
date = detail["date"]
message = self.base_message
new_msg = message.format(
name=name,
date=date,
total=amount
)
self.messages.append(new_msg)
return self.messages
return []
def some_rando():
print("yehahahsdfa")
unf_message = """Hi {name}!
Thank you for the purchase on {date}.
We hope you are exicted about using it. Just as a
reminder the purcase total was ${total}.
Have a great one!
Team CFE
"""
def make_messages(names, amounts):
messages = []
if len(names) == len(amounts):
i = 0
today = datetime.date.today()
text = '{today.month}/{today.day}/{today.year}'.format(today=today)
for name in names:
"""
Here's a simple solution to capitalize
everyone's name prior to sending
"""
name = name[0].upper() + name[1:].lower()
"""
Did you get the bonus??
"""
new_amount = "%.2f" %(amounts[i])
new_msg = unf_message.format(
name=name,
date=text,
total=new_amount
)
i += 1
print(new_msg)