Summary of python learning notes

1 course resources:


2 key points of knowledge (Level II test center)

(1) The document must be saved before execution
(2) Programming language type:
A: Machine language
B: Assembly language
C: High level language (C, C + +)
D: Super language (python)
(3) Two programming methods of python
Interactive: irreversible REPL(Read – Eval – print – loop)
File type: save! Modify! Expand! You must save before running!
(4) Code meaning
import turtle
Turn. Circle (20) from left to right from top to bottom,90)120: radius 90: center angle
Circle (120,90) 90 center angle? coca
(5) Static language (compilation): one-time translation without source code (C language, Java)
Scripting language (Interpretation): translate and execute at any time during each run (Python, js.PHP)
( 6 ).help()
(7) basic syntax elements:
1) Indent: usually with four spaces or a Tab
Note: single line #, exclusive line or end of line;
Multiple lines of three single quotation marks'... '' or three double quotation marks'... ',
Naming: upper and lower case letters, numbers or underscores (shift ±) or Chinese characters (not only Chinese characters). The first character cannot be a number
Reserved words:

2)Data type, string, integer, floating point number, list
3)Assignment statement, branch statement, function

learning method:
Learn first, then imitate, and then innovate independently

4. Learning suggestions:

1. Record knowledge points in time for examination

5 similarities and differences

**(1 + 1.01) * * 365: multiply 1.01 365 times (power algorithm)

6 basic grammar

(1) Data: variables and constants

(2) Object: identity (ID), type (type), value (value)

(3) Variable: the name (identifier) is the same as the naming rule. Valid variable name and invalid variable name

                Upper and lower case letters, numbers, or underscores( shift+-)Or Chinese characters, The first character cannot be a number

(4) Reserved word (keyword)

(5) Data type:

     Numeric: integer( int)

                    Floating point:( float)

                    Plural( complex)

Boolean: True(1)/False(0)

String (str): use 'str' / '...' / '' str 'as the delimiter, and + shift in Chinese and English, indicating the original string guided by the letter R or R

 Operation: str1+str2(Link to string)

            str*int(Copy of string)



Dictionary (dict):


7 library and method

(1)turtle: gallery
    Import format:
         import<Library name>
        <Library name>.Function name (parameter)
        import<Library name> as <Short name of the library>
        <Short name of the library>.Function name (parameter)
        from<Library name>import<Library name/Function name>(*)
          Function name (parameter)
     pensize(Brush size pixels)
    pencolor('Brush color')/(R,G,B)(0-1)
            color('stroke color ','fill color')
     circle(Circle radius r pixel),r Positive--Left, r Negative--Right.
            left(Angle): pay attention to the difference between the two angles

8. Basic structure of program

(1) Sequential structure
(2) Select (Branch) structure
If < condition 1 >:
Structure 1
Structure 2
Structure n
(3) Cyclic structure
for i in range():
structural morphology

9. Function:


10. Basic method of programming (IPO):

    (1)I(input):Enter data (string) on the keyboard
    (2)P(process):Processing of input data
    (3)O(Output):Enter data on the display.

11. Basic steps of programming:

     (1) determine IPO(Input--Process--output)
     (2) Programming
     (3) Debugging program

12. Numeric operators and expressions

     (1)Arithmetic:+,-,*,/(General division),//(floor divided by floor),% (remainder / modulus), * (arithmetic)
     (2)Assignment:=,Compound with arithmetic and bitwise operators
     (3)Relationship (comparison):>,<,==,>=,<=,!=    (True/False)
     (4)Logic: and or not                      (True/False)
     (5)Members: in ,not in                     (True/False)
     (6)Identity (identity test) is ,is not         (True/False)

13. Operator priority:

       Index(**)----->one yuan+- -->*,/,%,//,-->+,- --->>>,<<

14. Data type conversion:

(1)int():     Convert to integer
          (2)float():   Convert to floating point
          (3) complex(): convert to
          (4)bin():     Convert to
            (5) oct():       Convert to
            (6) hex():     Convert to

Tags: Python Back-end

Posted on Thu, 11 Nov 2021 05:25:46 -0500 by pkSML