Learn Python 3 the Hard Way 学习笔记
嘻嘻,萌生了这个想法,希望能检出到最后呀
Ex0
** cd\ ** 换到根目录
Set-Location 切换路径
New-Item 生成新文件或者新路径
mkdir 路径名 直接生成新路径
Ex1
路径> python ex1.py(文件名)
可以运行python 代码
Print(“字符串”)
输出
#
注释符号,只能单行注释
Ex3
Order of operations: PEMDAL, PE(M&D)(A&S)
(Parentheses圆括号 Exponents幂 Multiplication Division Addition Subtraction)
+ plus
- minus
/ slash (总是浮点数)
** * ** asterisk
% percent 取模,返回除法的余数,X is devided by Y with J remaining
< less-than
> greater-than
<= less-than-equal
>= greater-than-equal
// 取整(地板除):返回商的整数部分
****** 幂
== 等于
<> 不等于
!= 不等于
位运算符:
& 按位与
| 按位或
^ 按位异或
~ 按位取反
<< 左移
>> 右移
Ex4
The _ in space_in_a_car is called an underscore character.
= is called "equal"
4.0 * 3 =
>>>120.0
4 * 3 =
>>>120
!Space should be added around operators so that it’s easier to read. (运算符两边应该留空格,规范代码,方便阅读)
= (single-equal) assigns the value on the right to a variable on the left. The == (double-equal) tests whether two things have the same value. (前者赋值,后者为条件运算符,判断对错)
Ex5
Embed variables inside a string by using a special { } sequence and then put the variable you want inside the {} characters
Must start the string with the letter f for “format”
Eg.
f “Hello { somevar } ”
注意: f is right before the double quotes. (f 和双引号之间无空格)
A name starts with a character or _ (命名以字母或下划线开头,具体规范命名可以在CSDN查查)
round( ) 函数
今天暂时到这里啦,笔者看的是英文版的,所以有些笔记直接做英文的。