-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUser Data.py
More file actions
78 lines (68 loc) · 2.33 KB
/
User Data.py
File metadata and controls
78 lines (68 loc) · 2.33 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
import random
import string
list = []
def profile_generator():
print('Please enter your details below')
Firstname = input('Firstname: ')
Lastname = input('Lastname: ')
Email = input('Email: ')
'''
# This generates a random password for the user from
:param firstname:
:param lastname:
:return: randomly generated password
'''
Password = f' {Firstname[0:2]}{Lastname[-2:]}'
Password += ''.join(random.choice(string.ascii_letters) for i in range(5))
print('your password is:')
print(Password)
feedback = input('Satisfied with password Yes/No? : ')
if feedback.upper() == 'YES':
print('Done, Thank you for registering!')
else:
"""
# This enables user to input desired password
: return:
"""
new = input('Enter desired password: ')
while True:
if len(new) < 7:
new = input('Password must not be less than 7 characters, try agin: ')
elif len(new) >= 7:
Password = new
print('Password Ok')
print('Done, Thank you for registering!')
break
'''
This generates the profile dictionary and inserts it in the list.
: return: None
'''
user_details = {
'Firstname': Firstname,
'Lastname': Lastname,
'Email': Email,
'Password': Password
}
list.append(user_details)
'''
This compiles the list profiles and prints out the list.
:return: None
'''
while True:
counter = 0
action = input('To continue to next user, press 1 otherwise press 2 \n: ')
if int(action) == 1:
profile_generator()
elif int(action) == 2 and list == []:
print('No records founds')
break
elif int(action) == 2 and list != []:
print('These are the details of all registered users.\n---------------------------\n ')
for profile in list:
print(f'Firstname: {profile["Firstname"]} \n'
f'Lastname: {profile["Lastname"]} \n'
f'Email: {profile["Email"]} \n'
f'Password: {profile["Password"]}\n')
break
break
profile_generator()