3day
Python basic syntax
1, Operator: arithmetic operator, comparison operator, assignment operator, logical operator
A, arithmetic operator: a=10,b=3
+ Plus A+b
-Minus A-B
* by A*b
/except A/b
% modulus a%b (take remainder)
Take an integer a//b (the integer part of the fetch)
* * Power a**b (b-th)
B, comparison operator: a=10,b=3
= = equals
! = does not equal
<> Not equal to
< less than
> Greater than
<= less than or equal to
>= greater than or equal to
C, assignment operator: a=10,b=3,c=10
= equals to assigning the value of a to D
+ = plus equals equivalent to C=c+a
-= minus equals equivalent to C=c-a
*= equals equivalent to C=c*a
/= equals equivalent to C=C/A
%= modulo equals c=c%a
= rounding equals equivalent to c=c//a
A power of **= equals to the equivalent of C=c**a
D, logical operator: a=10,b=3,c=10
And and
Returns true only if the condition is satisfied, and returns False if one of the conditions is not satisfied
OR OR
Returns False if none of the conditions are satisfied, or true if one of the conditions is satisfied
Not non-
Force the returned result to TRUE or false
2. Process Control:
Single Branch
Dual Branch
Multi-Branch
3. While loop
4. Dead Cycle
5. Break and Continue
Break jumps out of the current loop and no longer executes
Continue terminates this cycle and continues the next cycle
6, optimize the game of guessing age
Python Beginner Third Day