Python3 is suitable for beginners to learn how to log on to the system by using a bank account.

Source: Internet
Author: User

Python3 is suitable for beginners to learn how to log on to the system by using a bank account.

I. knowledge points used:

1. Combination of for loop and if judgment

2. Use of % s placeholders

3. Use of auxiliary signs (flag spaces)

4. Use of break

Ii. Sample Code:

'''Bank logon system' uname = "bob" passwd = 123 judgment = 0 choice = 2for I in range (3): username = input ("Enter the User Name: ") password = int (input (" enter the password: ") if username = uname and password = passwd: # print ("~~~ Welcome % s to use the bank self-service system ~~~ "% Uname) # % s is the placeholder judgment = 1 break else: if choice! = 0: print ("!!! Login Failed !!! "+" You have "+ str (choice) +" ") else: print ("!!! Login Failed !!! ") Choice = choice-1if judgment = 0: print (" three chances are used up, this card will be frozen for 10 minutes ") # Only prompts, the freeze operation is not written # The second approach # uname = "bob" # passwd = 123 # choice = 2 # for I in range (3 ): # username = input ("Enter the User name:") # password = int (input ("enter the password:") # if username = uname and password = passwd: # print ("~~~ Welcome % s to use the bank self-service system ~~~ "% Uname) # % s is a placeholder ## break # else: # if choice! = 0: # print ("!!! Login Failed !!! "+" You still have "+ str (choice) +" ") # else: # print ("!!! Login Failed !!! ") # Choice = choice-1 # else: # print (" the three chances have been used up, and this card will be frozen for 10 minutes ")##

The above Python3 is a bank account logon system instance suitable for beginners to learn. It is all the content that I have shared with you. I hope you can give us a reference and support the help house.

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.