the Users = { " wulaoshi " : " 123456 " } login_users = {} Books = {} DEF the Register (): , Ltd. Free Join the Users the while 1 : username = the INPUT ( " Please enter the user name you want to register: " ) IF not len (username )> = 7 : Print ( " the username you entered is less than 7, please re-enter " ) the Continue for i in username: IF not(i> = " A " and i <= " z " ) and i =! " _ " : Print ( " The user name you enter must be lowercase or _! " ) BREAK the else : IF username in the Users: Print ( " the username you entered already exists, please re-enter! " ) the Continue BREAK the while 1 : password = the iNPUT ( " Please enter the password you want to use: ") IF not len (password)> = 7 : Print ( " The password you entered is less than 7, please re-enter " ) the Continue for i in password: IF not (i> = " A " and i <= " z " ) and ! = I " _ " and Not (I> = " 0 " and I <= " . 9 " ): Print ( "The password you enter must be lowercase letters, numbers or _! " ) BREAK the else : password2 = the INPUT ( " Please enter the password you want to use again: " ) IF password == password2: the Users [username] = password Print ( " % s registration has been successful! " % username) BREAK the else : Print ( " ! Please enter the password twice inconsistent re-enter! " ) DEF the Login (): , Ltd. Free Join the Users the while 1: Login_username = the INPUT ( " Please enter your login user name: " ) login_password = the INPUT ( " Please enter the password: " ) IF login_username in the Users: IF login_password == the Users [login_username]: Print ( " % S user logs in successfully ! " % login_username) login_users [login_username] = None BREAK Print ( " you enter a user name and password is incorrect, please re-enter! " ) DEF addBook (): Global Books BookID = INPUT ( " Enter a new book book ID: " ) IF BookID Not in books.keys (): for I in BookID: IF Not (I> = " 0 " and I <= " . 9 " ) : Print ( " enter the book id is not a pure numbers, please re-enter " ) BREAK the else : book_name = the iNPUT ( " Please enter the name of the new book: " ) IF book_name.strip =! "" : Books [the BookID] = book_name Print ( " ! Add Books"% s "success " % book_name) DEF listbooks (): for k, v in books.items (): Print ( " Book No S%:% S " % (k, v)) # the Register () # the Login () Print ( " Welcome to glory Road Library system: " ) Print ( " "" list of commands: registered users please enter: register Please enter: login Adding new books: addbook See all books: listbooks "" " ) the while 1 : the Command = the INPUT ( " Please enter a command to operate: " ) IF not the Command in [ " the Register " , " the Login " , " addBook " , " listbooks " ]: Print ( " command you entered does not exist, please re-enter! " ) the Continue Exec (the command + " () " )