-
Notifications
You must be signed in to change notification settings - Fork 0
/
replits100DaysOfPython_day34_prettyPrinting.py
149 lines (119 loc) · 4.06 KB
/
replits100DaysOfPython_day34_prettyPrinting.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import os #system()
import time #sleep()
# email_list = []
#test list
email_list = ["[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"]
# def print_email_list():
# print("Printing the current email list...\n")
# time.sleep(1)
# # total_characters = pipe + space + 2 + space + pipe + space + email_length + space + pipe
# total_characters = 9
# for email in range(0, len(email_list)):
# print(f"{email + 1:>2}: {email_list[email]}")
# time.sleep(.25)
# print("\nEnd of the list.")
# time.sleep(5)
def print_email_list():
# Look:
# ===============================================
# | 1 | [email protected] |
# | 2 | [email protected] |
# | 3 | [email protected] |
# 123456789
# | | email |
longest_email_length = -1
for email in range(0, len(email_list)):
if longest_email_length < len(email_list[email]):
longest_email_length = email
print(longest_email_length)
line = '-'
print(line * longest_email_length + line * 9)
print("Printing the current email list...\n")
time.sleep(1)
line = '-'
space = ' '
print(line * 9 + line * longest_email_length)
for email in range(0, len(email_list)):
space = space * (longest_email_length - len(email_list[email]))
print(f"| {email + 1:>2} | {email_list[email]} |")
time.sleep(.25)
print(line * 9 + line * longest_email_length)
print("\nEnd of the list.")
time.sleep(5)
def add_email():
email = input("Email to add: ")
print()
if email in email_list:
print("Email is already in the list.\n\nReturning to main menu...")
time.sleep(1)
elif email not in email_list:
email_list.append(email)
print_email_list()
print("Returning to the main menu...\n")
time.sleep(1)
else:
print("ERROR! Unable to add email to the list.\n\nReturning to main menu...")
time.sleep(1)
def remove_email():
print_email_list()
print()
email = input("Email to remove: ")
print()
if email in email_list:
email_list.remove(email)
print_email_list()
print("Returning to the main menu...\n")
time.sleep(1)
else:
print("ERROR! Unable to find that email.")
time.sleep(1)
def show_emails():
print_email_list()
print("Returning to the main menu...\n")
time.sleep(1)
def get_spamming():
for email in range(0, 11):
os.system("cls")
print(f"Email {email + 1}\n")
time.sleep(1)
print(f"Dear {email_list[email]}")
print("It has come to our attention that your're missing out on \nthe amazing Replit 100 days of code. We insist you do it \nright away. If you don't we will pass on your email\naddress to every spammer we've ever encountered and also\nsign you up to the My Little Pony newsletter, because\nthat's neat. We might just do that anyway.\n")
time.sleep(1)
print("Love and hugs,\n")
time.sleep(1)
print("Ian Spammington III\n")
time.sleep(2)
print("Returning to the main menu...\n")
time.sleep(1)
def print_main_menu():
print("SPAMMER Inc.\n")
time.sleep(1)
print("1: Add email")
time.sleep(1)
print("2: Remove email")
time.sleep(1)
print("3: Show emails")
time.sleep(1)
print("4: Get SPAMMING")
time.sleep(1)
print()
while True:
os.system("cls")
print_main_menu()
choice = int(input(">> "))
print()
if choice == 1:
add_email()
continue
elif choice == 2:
remove_email()
continue
elif choice == 3:
show_emails()
continue
elif choice == 4:
get_spamming()
else:
print("Exiting the program...")
time.sleep(1)
exit()