Learn Python 3 the Hard Way 学习笔记ex1-5(会持续更新)

Learn Python 3 the Hard Way 学习笔记

嘻嘻,萌生了这个想法,希望能检出到最后呀

Ex0

** cd\ ** 换到根目录
Set-Location 切换路径
New-Item 生成新文件或者新路径
mkdir 路径名 直接生成新路径

Ex1

路径> python ex1.py(文件名)
可以运行python 代码
Print(“字符串”)
输出
#
注释符号,只能单行注释

ex0 和 ex1 的运行

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( ) 函数
round 函数

今天暂时到这里啦,笔者看的是英文版的,所以有些笔记直接做英文的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值