-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
31 lines (26 loc) · 853 Bytes
/
main.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
from functions import *
def menu():
print("\n==== Programming Quotes ====")
print("random : Random quote")
print("display : Display quotes")
print("add : Add a new quote")
print("exit : Exit the program")
def main():
while True:
quotes = load_quotes("quotes.txt")
menu()
choice = input(">> ")
if choice == "random":
print_quote(random_quote(quotes))
elif choice == "display":
count = int(input("Enter the number of quotes to display: "))
display_quotes(quotes, count)
elif choice == "add":
add_quote(quotes, "quotes.txt")
elif choice == "exit":
print("Good bye...")
break
else:
print("Invalid input")
if __name__ == "__main__":
main()