The first python program and the first python Program

Source: Internet
Author: User

The first python program and the first python Program

The next day after learning python, I finally edited the first program. The program requirements are as follows:

1. Enter the user name and password

2. The welcome information is displayed after the authentication is successful.

3. Lock after three wrong attempts

 

The source code is as follows:

Username = 'Jackson'
Password = 'ee19'


Count = 0
While count <= 3:
_ Username = input ("username :")
_ Password = input ("password :")

If _ username = username and _ password = password:
Print ("welcome! User {name} login... ". format (name = username ))
Break
Else:
Print ("error! Please try again! ")

Count + = 1
If count = 3:
Countine_confirm = input ("you are banned! ")
Break

 

During the code correction process, the first 'Break' always reports an error. At first, I thought it was a logic problem. After repeated corrections, I found that the logic was correct, but the output always reported an error. Later, with the help of teamworker, we realized that there is no alignment. Because "';'" is not used in python to separate paragraphs, every logical statement must be formatted and aligned. I have discovered the new world for a novice python like me. Although it is only a small problem, it is also a great improvement.

The code may be cumbersome. please correct me!

 

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.