python full stack day02 notes + jobs

1, yesterday Recap

  Compiled: all-time code is compiled into a binary file

      c,c++

      Advantages: high efficiency

      Disadvantages: slow development, can not be cross-platform

  Interpreted: When the program runs, explain line by line from top to bottom into binary.

      Advantages: the development of high speed, high efficiency, cross-platform

      Cons: low operating efficiency

 

  The difference between the macro python2X and python3X:

      python2X source, repeat rate, not standardized, simple and elegant python advocating clear, so creating a python3, standardization.

  python2 Chinese error

      Solution: In the first line plus # - * - encoding: utf-8 - * -

  Variables: can not begin with numbers, letters, underscores in any combination of digital

     Having descriptive keywords can not be used, can not be used Chinese, can not use phonetic

  Constants: python is not constant, all uppercase agreement commonly known, can not be changed

  Notes: # single line comment Multiline comments '' '' ''

  User interaction:

      input: Data Types group all str

  type of data:

      int、str、bool、

2, explain the job

  2.1 Input while loop 1234568910

  pass: Skip, nothing execution

count = 0
while count < 10:
    count += 1
    if count == 7:
        pass
    else:
        print(count)
count = 0
while count < 10:
    count += 1
    if count == 7:
        continue
    print(count)

  2.2 seeking 1-100 number and all

count = 1
while count < 101:
    if count % 2 == 0:
        print(count)
    count += 1

  2.3 the output of all the odd 1-100

count = 1
while count < 101:
    if count % 2 == 1:
        print(count)
    count += 1

   All required number of 2.4 + 3-4 + 1-2 and 5 ... 99

sum = 0
count = 1
while count < 100:
    if count % 2 == 0:
        sum = sum - count
    else:
        sum = sum + count
    count += 1
print(sum)

  2.5 user logs on (three chances to retry)

= I 0
 the while I <. 3 : 
    username = INPUT ( ' Enter account number: ' ) 
    password = int (INPUT ( ' Enter password: ' ))
     IF username == ' salted Brother '  and password == 123 :
         Print ( ' Login successful ' )
     the else :
         Print ( ' login failed, please log in again ' ) 
    i + = 1

3, pycharm use

  Download the official website: Less Required Professional Edition, English, Community Edition features

  Activation method: public concern No. naked pig activated step by step

  When you create a new project path must be in English, otherwise it will error

  pycharm use https://edu.51cto.com/course/9043.html

  

     

     

     

 

  hot key:

  All comments: ctrl + /

  Copy on the line: ctrl + d

 

 4, the output format

   % Placeholder character d represents a number represented by s

   %% simply display%

    

 

     

 

5、while else

   When the while loop is interrupted break, the results will not be else, if not interrupted, will be executed

 

6, initial encoding

  Transmission computer, there are actually stored 01010101 binary code, etc.

  United States: ASCII code in order to solve word problems that globalization creates a Unicode, unicode

    very beginning

    1 byte to represent all English, special characters, numbers, etc.

    2 bytes, 16 denotes a Chinese, is not enough, a Chinese Unicode represented by four bytes

    You 00000000 00000000 0,000,000,000,000,100

    

    Upgraded version utf-8

    Chinese represented by a 3-byte

    Encoding gbk Chinese people to create their own (except for domestic use) a Chinese represent only Chinese and English with two bytes, and the rest did not

  

    Chinese: more than 90,000 words

 

7, the operator

  and or 

Guess you like

Origin www.cnblogs.com/draculaspider/p/11951121.html