It refers Python Python programming language (including grammar rules, effective for writing python code) and Python interpreter (read the source code and execute Python).
python interpreter software running python program, IDLE (Interactive Development Environment) is a program of local input
Mathematical operators, as follows:
Operators | operating | Case | evaluate |
** | index | 2**3 | 8 |
% | Modulo / take the remainder | 22%8 | 6 |
// | Divisible / quotient rounding | 22//8 | 2 |
* | multiplication | ||
- | Subtraction | ||
+ | addition |
1.2 integer, floating point and string data types
1.3 strings and replicate
>>> 'Alice' + 42
Error: TypeError: can not convert 'int' object to str implicitly, because the python can not be done automatically type conversion.
>>> 'Alice' * 3
Copy AliceAliceAlice, string
1.4 Save the value in a variable
1.4.1 assignment
1.4.2 variable name
rule:
- Only one word
- Only contain letters, numbers, underscores
- You can not begin with a number
Often mistakes: with the underlined with a space, the beginning of numbers, special characters ( ', *, ¥)
Variable names are case sensitive
Variable names use camel form (lookLikeThis, the book is recommended) or PEP8 (looking_like_this, official recommended)
1.6.5
Text and numbers equal Analyzing
>>> 42 == '42'
False
>>> 42 == 42.00
True
>>> 42 == 0042.00
True
1.7 summary
+ - * // **% are mathematical operators
* Is the string operator +