Starting today to learn python, there is no special purpose, just think the language is more interesting, since it may not be used now, then directly from the Python3 learn it!
I began to study, or like to listen to others, and then found the Little turtle "0 basic Learning Python", think that the C and C + + are watching the video of the small turtle, talking about the interesting, not boring, you can stick to see.
Study the first day, it seems 6 episodes, but because of the basis of other languages, so a lot of content understanding is relatively fast, but as the saying goes, good memory than bad writing, or summarize what you learned today.
(1) Features of Python
1. Indent. Unlike the C, C + +, which was previously learned, Python completely shrinks in place of the braces in other languages, starts a bit unaccustomed, runs often error, of course, most of it is due to copy and paste caused, so honestly hand code, learning a new language before, more dozen typing is also very good ... Right when you are familiar with the code format.
2. Variable usage does not require a qualifying type. Unlike some languages such as C, C + +, Python simply assigns a value before the variable is used, without declaring and specifying its data type. However, it does not mean that the variable has no type.
(2) Several bif (built-in function) in Python
Print (): Prints content to screen
Input (): Enter content into program
Int (): Convert to integral type
STR (): Convert to String
Float (): Convert to floating-point
Type (a): Gets the types of variable a
Isinstance (A,type): Determines whether a is a specified type
(3) About Boolean type
Its Boolean variable is somewhat similar to C + + and true means that 1,false represents 0 and not 0 is true
(4) commonly used operators
+ 、—、 *,/,%, * *,//, respectively, add, subtract, multiply, divide (exact value), take surplus, power, divide (rounding)
(5) Logical operators
Not and OR
(6) Some contents of the string
Strings can be either single quotes or double quotes
1. Original string: With R in front of the string, the string remains intact.
For example: R ' C:\now ' is ' C:\now ', where ' \ n ' is not escaped;
2. Long string: A string that spans multiple lines using three quotation marks (single or double quotes).
For example: ' How is it? '
I ' M fine. "
The path to learning Python