My python trip! The first week of operation

# The first week of operation 
filename = 'heimingdan.txt' # storage is prohibited logged-on user name, build a heimingdan.txt documents in the current directory software
i = 0
the while i <3:
name = the INPUT ( "Enter your name: ")
with Open (filename) AS the file_object:
name1 = file_object.readlines () # inside the file contents of each row are stored in name1 list
for J in the Range (len (name1)):
NAME3 = name +" \ the n-"
IF == NAME1 NAME3 [J]:
Print ( "! this user has been locked and can not log in")
Exit ()
password = the iNPUT ( "enter your password:")
IF name == "BASM" and password == "basm1990 ":
Print ("% S is available for purchase "% name)
BREAK
the else:
Print (" wrong password or account, you have% d chance. "%(2-i))
i = i+1
if i==3:
with open(filename,'a') as file_object:
file_object.write(name)
file_object.write("\n")
break
continue

 

Guess you like

Origin www.cnblogs.com/moon4131/p/11261704.html