Python development "1th article"

Source: Internet
Author: User

1.python Interpretation Execution principle

Python code--byte code--machine code--Computer

Each run is converted to bytecode, and then the virtual machine converts the bytecode into machine language, which can then be run on the hardware.

2. Variables

The value of the program during its run is the amount allowed to change.

Variable naming rules:

①. Numbers, letters, underscores

②. Cannot start with a number

③. Cannot be a keyword inside python

3. Data type

Digital

String: "or" or "" "" "

Boolean value: TRUE or False

4. Enter

1 # -*-coding:utf-8-*- 2 3 4 # assigning user-entered content to the name variable 5 name=raw_input ("Please enter user name:")67#  Print input 8 Print Name

Weak or invisible when entering a password, the Getpass method available in the Getpass module

1 # -*-coding:utf-8-*- 2 3 Import Getpass 4 5 pwd = Getpass.getpass (" Please enter password:")

5. Conditional statement (IF...ELSE)

1 #print their permissions based on what the user has entered2   3 #Alex--Super Admin4 #Eric--General Administrator5 #Tony,rain--- business executives6 #other--Ordinary users7 8Name = Raw_input ('Please enter user name:')9     Ten ifName = ="Alex": One     Print "Super Admin" A elifName = ="Eric": -     Print "General Administrator" - elifName = ="Tony" orName = ="Rain": the     Print "Business Supervisor" - Else: -     Print "Normal User"

6.while Cycle

①. Basic Loops

 while Conditions:          # Loop Body     # if the condition is true, then the loop body executes    # if the condition is false, then the loop body does not perform

②.break (for exiting all loops)

 while True:     Print " 123 "     Break    Print " 456 "

③.continue (used to exit the current loop and continue the next loop)

 while True:     Print " 123 "    Continue    Print " 456 "

Small Programming (http://www.cnblogs.com/wupeiqi/articles/5433925.html)

1. Use while loop input 1 2 3 4 5 6 8 9 10

2. For all numbers of 1-100

3. All odd numbers in output 1-100

4. All even numbers in output 1-100

5, Beg 1-2+3-4+5 ... 99 of all numbers of the and

6. User Login (three chance retry)

Python development "1th article"

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.