-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
48 lines (46 loc) · 1.42 KB
/
test.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
45
46
"""
this is a samll program, you can user id and password login,
if you have try three times ,your id will been locked>
"""
_username = "abc"
_password = "123"
counter = 0
while counter <3:
username = input("Username:")
readfile = open("C:\lock.txt")
lockuser = readfile.readline()
if lockuser == username:
warning="""
++++++++++
You has been locked!
++++++++++
"""
print(warning)
else:
password = input("Password:")
if _username == username and _password ==password:
info="""
+++++++++++++++++
welcome to {name}
+++++++++++++++++
""".format(name=username)
print(info)
break
else:
counter = counter+1
trylogin = 3 - counter
helpinfo ="""
Your username or password is wrong,please check your id and password!
if you try more than three times ,your id will been locked !
you can try {trylogin} !
""".format(trylogin = str(trylogin))
print(helpinfo)
if counter == 3:
lock = open("C:\lock.txt","w")
lock.write(username)
lockwarning = """
++++++++++
You will been locked!
++++++++++
"""
print(lockwarning)