L1
The beginning of the #! Enkoding: utf-8
Print () can only write a number in brackets
Variable names - letters, Numbers, underscore,
Can't the opening is digital
A=1 to the right of the assignment to the left
Print () is a direct output value in brackets
Variable is a variable value
A=1
A=2
From top to bottom, the value behind the
On the keyboard in English plus + minus - by * in addition to/
Python L2
The content of the string is output in double quotes ""
String concatenation with +
Spaces and behind the letters
S="age"
S a string variable age string
String variable together without the double quotes
L3
Program is executed in the order from top to bottom
Condition of the structure of the format is by the if conditions and a colon followed by a
Only meet the if condition in brackets, the corresponding code block will perform
Generally after input the if () : after the return, the editor will help us to automatically add four indentation
Compared with the if the left position indented four Spaces statement, said to belong to the if the code block of
If a new line indentation and the number of Spaces before different, started a new block of code
If the else structure
If met the conditions of execution in brackets if the corresponding code block
In brackets if conditions are not met, perform the else the corresponding code block, behind the else need to add a colon:
L4
List
Scores are a list elmenet is the element of the list
In Python, use square brackets [] to represent the list, with a comma to separate the element
Note that if the element is a character (String),
element to add double quotation marksIn the list, each element has an index (index)
In Python, the first list element is at index 0 instead of 1
Name list to add elements to list. Append (" ")
Reduction elements - the list of names. Remove (")
L5
Rounded int ()
For maximum a=Max (list)
For the minimum a=min (list)
A=length len ()
Beg absolute abs (abs) is the first few letters take absolute, become a "
Pow (x, y) x y power
L6
True circulation loop conditions, false exit loop
A for loop statement
For num nums in:
Range (1, 5), 1234 does not include 5
Procedures for the value in the range (1, 5) :
Print (value)
Results 1
2
3
4
If the print (" I love you "), the result is
I love you
I love you
I love you
Nums=list (range (1, 7))
Print (num)