Python basics, simple login verification

Source: Internet
Author: User
Learn python for the first time, confused, write a simple login verification, make notes

username = ‘cc‘ #用户名userpassword = ‘123‘    #密码count = 0         #计数器while count<3:      #如果计数小于3,即0,1,2共三次,则执行以下代码    _username = input("USER:")      _userpassword = input("PW:")    if _username == username and _userpassword == userpassword:   #判断用户输入的用户名和密码是否一致        print("wlcome",username,"back.~~v-v".format(username=username))        break    #一致则跳出循环    elif count<2:         print("not this user or password,try again")    count +=1  else:    print("lock!!!",username.format(username=username))

The code is simple and hopefully one year later you can write the code for the utility.

Python basics, simple login verification

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.