-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (27 loc) · 862 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
32
33
34
from read import *
from write import *
from delete import *
import sys
# This class has a constructor and 3 methods which call imported functions inside them.
class NotePad:
def __init__(self, filename):
self.filename = filename
def ReadNotePad(self):
read(self.filename)
def WriteNotePad(self):
write(self.filename)
def DeleteNotePad(self):
delete(self.filename)
if __name__ == "__main__":
myNotePad = NotePad("file.txt")
choice = ""
while choice != "exit":
choice = input("What would you like to do: \n (Type 1 to read, 2 to write and 3 to delete) \n")
if choice == '1':
myNotePad.ReadNotePad()
elif choice == '2':
myNotePad.WriteNotePad()
elif choice == '3':
myNotePad.DeleteNotePad()
else:
sys.exit()