1. Number of password entries 2, multi-level menu

Source: Internet
Author: User

1. Number of account password input

Condition: 1, enter user password

2. Display welcome information after successful authentication

3, the wrong three times after the lock

User= "Pengchun"

Password= "Pcwangjixuan"


f = open (' User.log ', ' R ')

Lock_file = F.read ()

F.close ()


Count = 0


For I in range (3):

User1=input ("Please input your name:")

Password1 = input ("Please input your passwor:")

For j in Range (1):

if Lock_file = = User1:

Print ("The account is locked")

Exit ()

Else

Continue

if user = = User1 and Password = = Password1:

Print ("Verification succeeded")

Break

Else

If i==2:

Print ("You have tried too many times and the system automatically exits")

Else

Print ("Login failed, please re-enter")

Count +=1

if Count = = 3 and User1! = "Pengchun":

Print ("You are using more than 3 users and the system is about to be locked")

f = open ("User.log", "W")

F.write ("%s"%user1)

F.close ()


2. Multi-level menu


1. Number of password entries 2, multi-level menu

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.