forked from spy0711/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9Ex5Harry.py
More file actions
40 lines (40 loc) · 1.04 KB
/
9Ex5Harry.py
File metadata and controls
40 lines (40 loc) · 1.04 KB
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
def getdate():
import datetime
return datetime.datetime.now()
def we(a):
if a == 1:
h1 = open("99Harry" + b + ".txt")
h1o = h1.read()
h1.close()
return h1o
elif a == 2:
h2 = open("99Rohan" + b + ".txt")
h2o = h2.read()
h2.close()
return h2o
elif a == 3:
h3 = open("99Hammad" + b + ".txt")
h3o = h3.read()
h3.close()
return h3o
def wer(a, d):
if a == 1:
f1 = open("99Harry" + b + ".txt", "a")
f1.append(getdate, d)
f1.close()
elif a == 2:
f2 = open("99Rohan" + b + ".txt", "a")
f2.append(getdate, d)
f2.close()
elif a == 3:
f3 = open("99Hammad" + b + ".txt", "a")
f3.append(getdate, d)
f3.close()
c = int(input("1 to Read, 2 for writing\n"))
b = input("Input Exercise or Diet\n")
a = int(input("1 for Harry, 2 for Rohan, 3 for Hammad\n"))
d = input("if you're writing then write it, otherwise hit enter\n")
if c == 1:
print(we(a))
elif c == 2:
print(wer(a, d))