While loop write 3 times user name password validator

Source: Internet
Author: User

#variable from the original user name and passwordUsername ='Admin'Password='Nimda'#Variable from counterCount =0#Loop condition counter is less than 3, execution while code block whileCount < 3:#variable from user input user name and passwordInuser = input ('input Username:') Inpass= Input ('Input Password:')#if the user name or password is inconsistent with the system variable, add 1 to the counter, print the prompt, and re-cycle immediately    ifInuser! = UsernameorInpass! =Password:count+ = 1Print('username or password error,please enter again')        Continue#The code goes here to verify that it passed, print the prompt, and interrupt the loop    Print('Welcome to Pythom are world')     Break#when the while condition fails, the hint has only three chances. Else:    Print('Sorry,juse Three')

While loop write 3 times user name password validator

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.