微软python for beginner_《Python for Beginners》学习笔记(1)

《Python for Beginners》为LearnStreet上的Python入门课程。课程网页设计得很友好,可以边学边练。作为Python的初学者,如果有C语言基础,理解起来也比较容易。该笔记将重点记录Python与C语言不同的语法和编程方法。

Lesson 2 Variables, Numbers and Booleans

学习笔记:

1.关键字(保留字):and, as, assert, break, class, continue, def, del, elif, else, except, exec, finally, for, from, global, if, import, in, is, lambda, not, or, pass, print, raise, return, try, while, with, yield.

2.两种主要数据类型:整型(int)和浮点型(float)

数据类型转换:

int(x): 将浮点型转换为整型

float(x): 将整型转换为浮点型

查看变量的数据类型:type(x)

3.布尔值:True or False

4. 比较运算符

== equal to

<   strictly less than

>   strictly greater than

<= less than or equal to

>= greater than or equal to

!    negates any of the above (e.g., != is not equal) (不是很清楚怎么用)

5. 算术运算符

+ add

- subtract

* multiply

/ divide

** power (5**2 = 25, or 5 to the second power) (与C语言不同)

// floor division (与C语言不同)

% modulus

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值