Python notes:
1.E notation, scientific counting method equals 10 of how many times Square. 1.5e5=150000.0. Note: The resulting number is floating point.;
2. Type conversion: Int (translates to shaping), str (converted to string), float ();
Note: The floating-point number is converted to an integer and the integer part is truncated. int (3.6) = 3;
Shaping into floating-point type, plus. 0;float (3) = 3.0;
Float (4e10) = ' 4e+10 '; + indicates positive or negative;
When the BIF keyword is used for a common variable name, in future use, Python will continue to use the new identity of the keyword, and will not use the original BIF functionality. Example: str= ' Zjh '; c=str (3), the first sentence can print Str smoothly, but the following statement will report an error.
3. Get information about the type.
type (); function. Example: A= ' 520 ', type (1), Printed: Class ' str ';
isinstance (). Returns a Boolean type value. A= ' Zjh '; isinstance (A,STR); return true;
4. Integer division (/), in Python3, returns the true result, without intercepting the integer part. 10/8=1.25; available (//) for floor division. 10//8=1;
5.** power operation, 3**2=9;
6. Logical operator: And,or,not;
Note: The other does not change. **,+,-, *,/,//,+,-, <,<=,>,>=,==,!=,and,or,not;
7.python in Elif=else if;
8. Unique ternary operator: condition operator. X if condition else y;
9. Assert assert. Throws an Assertionerror exception when the condition after the keyword is false.
10.while Condition: Loop body
11.for target in list: loop body; example for I in Zjh:print (i,end= ") z J H;
12.range ([Start,]stop[,step]); in which the parameters within the brackets are optional, step indicates the path. So,range the number of reference can be 1--3, when 1, the expression from 0--stop-1, when two, the expression from the start--stop-1, when three is indicated from the Start--end (end<stop), the step path is step;
Python learning about data types and looping essentials