Login (three chances of losing an error) and the remaining number of errors displayed each time the error is lost (Prompt: Enable? String format)

Source: Internet
Author: User
# I = 3
# Username = "yangxiaoer"
# Password = "123456"
# While I> = 0:
# Name = input ("Enter your Username :")
# If name = Username:
# Passwd = input ("enter your password :")
# If passwd = password:
# Print ("Logon successful. Please wait ")
# Print ('''
# Username: % s
# Password: % s
# ''' % (Username, password ))
# Break
# Else:
# Print ("Your password is incorrect. Please enter it again ")
# Print ("You still have % s chances" % (I-1 ))
# If I = 0:
# Print ('your chances are used up, end this operation ')
# Break
# Continue
# Else:
# Print ("your username is incorrect! Enter ")
# Print ("You still have % s chances" % (I-1 ))
# I-= 1




Second
Username = "yangxiaoer"
Password = "123456"
I = 3
While I> 0:
Zh = input ("enter your account :")
I-= 1
If ZH = Username:
Mm = input ("enter your password :")
If Mm = password:
Print ("Verification Successful... login ......")
Print (''' congratulations, you have logged on!
Welcome
Username: % s
Password: % s
''' % (Zh, mm ))
Break
Else:
If I = 0:
Print ("your chances are gone! See game over next time! ")
Answer = input ('try again? Y or n ')
If answer = 'y ':
I = 3
Print ("Incorrect password, please enter it again ")
Print ("You still have" + STR (I) + "opportunity ")
Else:
Print ("enter the correct user name! ")
If I = 0:
Print ("your chances are gone! ")
Answer = input ('try again? Y or n ')
If answer = 'y ':
I = 3
Print ("You still have" + STR (I) + "opportunity ")
Else:
Print ('Do you want your TM face ')

Login (three chances of losing an error) and the remaining number of errors displayed each time the error is lost (Prompt: Enable? String format)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.