-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.util.txt
More file actions
76 lines (61 loc) · 1.87 KB
/
code.util.txt
File metadata and controls
76 lines (61 loc) · 1.87 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
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
import os
def clear_screen():
"""Clear the terminal screen"""
os.system("cls" if os.name == "nt" else "clear")
def spinner():
"""Create effect for preparing the coffee"""
spinner = ["|", "/", "-", "\\"]
for _ in range(20): # se rotește de 20 de ori
for simbol in spinner:
sys.stdout.write(simbol)
sys.stdout.flush()
time.sleep(0.1)
sys.stdout.write("\b") # șterge simbolul anterior
print("")
def loading(x):
"""Create the loading effect"""
for _ in range(x):
time.sleep(0.5)
print(".", end="")
sys.stdout.flush()
def authenticate():
password = input("Enter technician password: ")
if password == TECHNICIAN_PASSWORD:
return True
else:
print("❌ Access denied. Incorrect password.")
return False
def cash_out():
if not authenticate():
return
# restul codului...
def refill():
if not authenticate():
return
print("Please enter the values in ml and g: ")
for item in resources:
try:
value = int(input(f"{item}: "))
resources[item] += value
except ValueError:
print("Invalid input. Skipping.")
print("All has been added successfully!✅")
def print_report():
if not authenticate():
return
print("\n====== REPORT ======")
# restul codului...
import getpass
def authenticate():
password = getpass.getpass("Enter technician password: ")
return password == TECHNICIAN_PASSWORD
==================================================================================
import getpass
TECHNICIAN_PASSWORD = "admin123"
def authenticate():
password = getpass.getpass("Enter technician password: ")
if password == TECHNICIAN_PASSWORD:
return True
else:
print("❌ Access denied. Incorrect password.")
return False