Python implements login password reset simple operation

Source: Internet
Author: User

Demand:

1. User Input Password correct login

2. User input password error exit and call function continue input

3. When the user enters a password that matches a given value, allows the user to reset the password and can log in with the new password

Although the paste is simple, but also to record, nonsense not much to say direct code

1 #!/user/bin/env python2 #-*-coding:utf-8-*-3 #Author:qinjiaxi4Password_list = ['[Email protected]#','12345']5 defAccount_login ():6password_input= input ('Please enter your password:')7Password_correct = Password_input = = Password_list[-1]#because the judging condition is too long can be assigned to a variable, so that the code looks neat and clean some8Password_reset = Password_input = =Password_list[0]9     ifPassword_correct:Ten         Print('Login success!') One     elifPassword_reset: ANew_password = input ('Please enter a new password:') - password_list.append (New_password) -         Print('your password has been modified successfully') the Account_login () -     Else: -         Print('Input Error') - Account_login () +Account_login ()

Python implements login password reset simple operation

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.