Old boy Python3.5 training first week homework

Source: Internet
Author: User

One, blog:

Second, edit the login interface

    1. Enter User name password

    2. Show welcome message after successful authentication

    3. Lock after entering three times




Three, multi-level menu

    1. Level three Menu

    2. Select to go to the respective sub-menu

    3. Required Knowledge points: List, dictionary

    4. You can exit to the previous menu at any time


Job Two:

I wrote it by myself:

#!/usr/bin/env python#-*-coding=utf-8 -*-#AUTHOR:d uwentaousername = [' Duwentao ', ' Liuxiaohui ']   #存储用户名password  = [' 123456 ', ' 456789 ']      # Store the corresponding password locking = []         #用于锁定n  = 0         #计算输入了几次while  true:    username = input (' Please enter user name: ')     if UserName not in locking:         if UserName in username:             password = input (' Please enter your password: ')              if password == password[username.index (username)]:                 print  (' login successful ')          &nBsp;       exit ()              else:                 n = n+1                 if n == 3:                     locking.append (UserName)                  print  (' Username or password error, Login failed ')          else:             password = input (' Please enter your password: ')              print  ("User name or password error, Login failed")     else:         print  ("The user has been locked down")


Operation Result:


Job Three:

Cond




Old boy Python3.5 training first week homework

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.