-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdsds.py
More file actions
106 lines (95 loc) · 3.21 KB
/
dsds.py
File metadata and controls
106 lines (95 loc) · 3.21 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
from simple_colors import *
class DATA:
def __init__(self,n):
self.n=n
def authorization(self,password,code):
self.username=input("Enter your name:")
password=input("Enter your password:")
code=input("Enter your code:")
if password=="" and code==0000:
return 1
else:
return 0
def input(self):
self._name=[]
self._age=[]
self._mobno=[]
self._email=[]
self._address=[]
for i in range(0,self.n):
name=input("Enter the candidates name:")
age=int(input("Enter the candidates age:"))
address=input("Enter the address:")
mob_no=input("Enter the mobile number:")
email=input("Enter E-mail:")
self._name.append(name)
self._age.append(age)
self._address.append(address)
self._mobno.append(mob_no)
self._email.append(email)
def searching(self,name):
for i in range(0,self.n):
if self._name==name:
return i
def serachedPrinting(self,i):
print(f'''Name - {self._name[i]}
Age - {self._age[i]}
Mobile number - {self._mobno[i]}
Email - {self._email[i]}
Address - {self._address[i]}''')
def filewriting(self):
#user .json to dump data
with open('data.txt','a') as f:
f.writelines(self.username + ":")
for i in range(0,self.n):
f.writelines(self._name)
f.writelines(self._age)
f.writelines(self._address)
f.writelines(self._mobno)
f.writelines(self._email)
x='''Welcome to the server,this is my first project
Points to be noted:
-You need to have username,password,
-pin(6 digits) to make new entries
'''
print( black('*') * 320+ '\n' +red(f'{x.center(900)}','bold') + '\n' +black('*') * 320)
choice=input('''Operations Available:-
-Become a member.(1)
-Adding DATA.(2)
-Editing DATA.(3)
-Accessing DATA.(4)
-Leave the PROGRAM.(5)
-EXIT! (6)
Enter your choice as numbers:''')
while(choice !=6 or choice.upper() !="EXIT"):
if choice==1:
name=input("Enter your name:")
username=input("Enter your username:")
password=input("Enter your password:")
#write this things to file and .json
elif choice==2:
numOfInput=int(input("Enter the number of participants data you will add:"))
d= DATA()
d.input()
d.filewriting()
elif choice==3:
#open file and edit the data
pass
elif choice==4:
__name=input("enter the account name you want to search:")
d=DATA(10)
_i=d.searching(__name)
d.serachedPrinting(_i)
elif choice==5:
__name=input("enter the account name you want to deleted:")
d=DATA(10)
_i=d.searching(__name)
d.serachedPrinting(_i)
fc=input("confirm(yes\no):")
if fc.upper()=="YES":
del d._name
del d._age
del d._mobno
del d._address
del d._email
print("ACCOUNT DELETED!!")