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!