1 course resources:
1,www.runoob.com
2,www.liaoxuefeng.com
3,www.csdn.net
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
turtle.pensize
turtle.color('red')
Turn. Circle (20) from left to right
turtle.circle(-20) from top to bottom
turtlr.circle(120,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()
keywords
(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
Variable
Reserved words:
2)Data type, string, integer, floating point number, list 3)Assignment statement, branch statement, function 4)input(),print(),eval(),print()format
learning method:
Learn first, then imitate, and then innovate independently
4. Learning suggestions:
1. Record knowledge points in time for examination
2,
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)
Tuple:
List:
Dictionary (dict):
Set:
7 library and method
(1)turtle: gallery Import format: A: import<Library name> <Library name>.Function name (parameter) B: import<Library name> as <Short name of the library> <Short name of the library>.Function name (parameter) C: from<Library name>import<Library name/Function name>(*) Function name (parameter) (2)method: 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. right(Angle) 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
elif:
Structure 2
...
else:
Structure n
(3) Cyclic structure
for i in range():
structural morphology
break()
continue()
9. Function:
(1)range(): (2)input(): (3)print():
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) (7)position:&,|,!,^,>>,<<
13. Operator priority:
high--------------------------------->low 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