1---2 * * 32 3---True andTrue4TrueorFalse5 notTrue6 7---python isa Smart language85/2 = = 5.0/2.0//False95 * 2 = = 5.0 * 2.0//TrueTen One---python isstore values instead of expression A ----Str ->>> 3 *'a' the 'AAA' - ->>> 3 *'AB' - Ababab + ->>>'a'+'a' + AA A at>>>'a'+ STR (3) - A3 - - function -1. Len () -2. Extract in2.1'ABC'[0] >>>'a' - 'ABC'[-1] >>>'C' to2.2'string'[Beg:end] [beg,end) + 'ABC'[1:3] >>>'BC' -2.3'string'[Beg:end:step] the *---raw_input () $ Panax Notoginseng---# - the--- +x = Int (Raw_input ('Enter an integer')) A ifx%2 = =0: the Print("') + Print('even') - Else: $ Print("') $ Print('ODD') - Print('Done with conditional') - the---range (n) [0,n-1] -Range (n,m) [n,m-1]Wuyi the--- forLetterinch 'Hola': - PrintLetter
Color Description:
This is the difference between Python and C + +
This is the difference between Python and Matlab.
This is a puzzle.
This is a question.
1. The difference between print mystring and >>>mystring
>>>print mystring is called STR ()
>>>mystring is called repr ()
2. _ Represents the value of the previous expression.
The difference between an expression and a statement
An expression can be understood as an expression; is an illegal statement in C + +
Statements can be interpreted as statements; is a valid statement in C + +
3.% output
>>>print'%s is number%d! ' % ('Python', 1 is
4. Enter
5. Document String
The call is much like Javadoc through module.__doc__ or class.__doc__ or function.__doc__.
6. Priority Level
* * > + +-*/
7.3 < 4 < 5: = 3 < 4 and 4 < 58. Extremely small number of operators
+ - * / % **
No--must use-= 1
Written questions:
1.--2//2-( -2) ^_^
2.2--//error
9. Shaping the scope of the representation >> int in C + +10. Plural is 1+2j not 1+2i11.List can be modified, [], type can be different
12.TupleNot to be modified, (),types can be different
Dict.
14.While
Because the while behind can not be used () so need: Explain the conditions have been finished
. Print line wrap print a with space16. List Resolution
17. Read in the file
18. Function def
--------------------------------------------------------------------------------------------------
1. Special characters
# Notes
\ nthe line break
\ continue to the next line of "'" or () [] {} Do not show the write \
; Connect 2 words
: Sub-opening and body
2. The difference between single and triple quotation marks
3. Assignment is a reference, the assignment does not return a return value
4. Variable assignment???
5. Assignment of multivariate assignment tuple values
6. Special variables
_xxx do not import with ' from module import '
_xxx_ System Definition Name
Private variable name of the _xxx class
7. layout???
Attention:
1. After import, functions and classes are defined.
2. The function called is __name__ = ' __main__ '
Main function is __name__ = module name
8. Counting
Increase:
1. Object creation
2. References
3. As a parameter
4. Become an element of a container
Reduce:
1. Leave {}
2.del y
3. Remove (x)
4.del List
Python Basic Knowledge Code example practice