-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEjercicio2.py
44 lines (32 loc) · 1.07 KB
/
Ejercicio2.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
from time import asctime
from unicodedata import name
def menu():
opt = '9'
while opt != '3':
print("1 - Employee entry. \n2 - Employee exit. \n3 - Exit menu. \n")
print("Select an option.")
opt = input()
if opt == '1':
print("Enter the name of the employee who entered")
name = input()
newString = str(employeeEntry(name))
print(newString)
saveFile(newString)
elif opt == '2':
print("Enter the name of the employee who exited")
name = input()
newString = str(employeeExit(name))
saveFile(newString)
elif opt == '3':
break
else:
print("Invalid option")
def employeeEntry(name = ''):
newString = str((f"{asctime()} - {name} - Entry"))
return newString
def employeeExit(name = ''):
print(asctime()," - ",name," - Exit")
def saveFile(entryOrExit = ''):
f = open("texto.txt", "w")
f.write(entryOrExit)
menu()