-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_Task02.py
More file actions
64 lines (57 loc) · 2.45 KB
/
Python_Task02.py
File metadata and controls
64 lines (57 loc) · 2.45 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
import random
'''Using 'for' In other to accepting the data details of students not more than 2'''
data_details = []
def main_login():
for x in range(0,2):
print("\nWELCOME TO HNG LOGIN FOR YOUR START-NG STUDENTS DETAILS")
First_name=input("\nEnter your First Name:\n")
Last_name=input("Enter your Last Name:\n")
email =input("Enter your Email Address:\n")
def randomString(length=9):
""" Generate a random string of fixed length for user password"""
your_letters = First_name[0:2] + Last_name[0:2]
return ''.join(random.choice(your_letters) for i in range (length))
password= randomString()
print("Your password is:", password)
Generated_password = input("Are you satisfied with the generated password for you? yes/no:\n")
if Generated_password =="yes":
details=['First Name: '+First_name,
"Last Name: "+ Last_name,
"Email Address: "+email,
"Password: "+ password
]
data_details.append(details)
print("Your HNG Details are:\n")
for data in details:
print(data)
else:
'''if the user is not satisfied with the generated password'''
Choose_Password=input("Enter a password not less than 7 characters:\n")
while len(Choose_Password)<7:
Choose_Password=input("Error!!\ninput a new password equal to or greater than 7 in length:\n")
else:
details =['First Name: '+First_name,
"Last Name: "+ Last_name,
"Email Address: "+email,
"Password: "+ Choose_Password
]
data_details.append(details)
for data in details:
print(data)
def all_students_details():
print("\nWELCOME TO HNG LOGIN FOR YOUR START-NG STUDENTS DETAILS")
print("\nThe Current Students Details:")
for each_details in data_details:
print(each_details)
global command
command=input('\nEnter A to get info from students'
'\nEnter L to list all your contacts'
'\nEnter Q to quit\n')
if command=='L':
all_students_details()
elif command =='A':
main_login()
all_students_details()
else:
quit()
all_students_details()