# User login (unsuccessful attempts to enter the opportunity) and each error is displayed when the remaining number of errors (Hint: Use string formatting)

# User login (three mismatched opportunities) and each remaining error display error count (Note: Use string format) 
# I =. 3 
# username = "yangxiaoer" 
# password = "123456" 
# the while I> = 0 : 
#      name = the iNPUT ( "Please enter your user name:") 
#      IF name == username: 
#          passwd = the iNPUT ( "Please enter your password:") 
#          IF == passwd password: 
#              Print ( "Login successful . Please wait ") 
#              Print ( '' ' 
#              username:% S 
#              password:% S 
#              ' ''% (username,password))
#             break
#         else:
#             print ( "Your password is incorrect, please re-enter") 
#              print ( "% s chance you have"% (i-1)) 
#              IF i == 0: 
#                  Print ( 'Your chance has been used up, ending the operation ') 
#                  BREAK 
#              the Continue 
#      the else: 
#          Print ( "! your user name is incorrect, please re-enter") 
#          Print ( "% s chance you have"% (i-1)) 
#      i - = 1 
# username = "yangxiaoer" 
# password = "123456" 
# i = 3 
# the while i> 0: 
#      zh = the iNPUT ( "Please enter your login:")
#     i -= 1
#     if zh == username:
#          Mm = the INPUT ( "Please enter your password:") 
#          IF mm == password: 
#              Print ( "verification is successful landing .......") 
#              Print ( '' 'Congratulations on your successful landing! 
#              users are welcome to enter the 
#              user name:% S 
#              password:% S 
#              '' '% (zh, mm)) 
#              BREAK 
#          the else: 
#              IF i == 0: 
#                  Print ( "your chance has gone game over! ! see you next time ") 
#                  answer the INPUT = ( 'N or re-try the Y-?') 
#                  IF answer == 'the Y-':
#                     i = 3
#             print ( "Wrong password, please re-enter") 
#              print ( "You have" + str (i) + "chance") 
#      the else: 
#          print ( "Please enter the correct user name!") 
#          IF i = 0 =: 
#              Print ( "! you did not have the chance") 
#              answer the INPUT = ( '? N or try again the Y-') 
#              IF answer == 'the Y-': 
#                  i = 3 
#          Print ( "you also there are "+ str (i) +" chance ") 
# the else: 
#      Print ( 'TM you want to shameless') 


i = 3 
username = ' ZZK ' 
password = '123456'
whilei> 0: 
    name = the INPUT ( ' Please enter your name ' ) 
    i = i - 1
     IF name == username: 
        password1 = the INPUT ( ' Please enter your password ' )
         IF password1 == password:
             Print ( ' Login successful ' )
             BREAK 
        the else :
             Print ( ' Please enter your number of errors remaining S% ' % (I))
             IF I == 0:
                 Print ( 'You have run out of opportunity to end this operation ' )
                 BREAK 
            the Continue 
    the else :
         Print ( ' user name is incorrect, the remaining number S% ' % (i))

 

Guess you like

Origin www.cnblogs.com/wgzzk/p/10968460.html