第一课《Hello,Python》
1.通过type()函数对不同变量进行类型查询
2.熟悉基本的运算符(单目、双目、三目),重点是“/,//,%”
3.运算符联合使用时遵循的PEMDAS顺序规则:Parentheses, Exponents, Multiplication/Division, Addition/Subtraction
4.熟悉常见的内置函数,如print、min、max、abs
第二课《练习:语法、变量和数字》
1.原生包的导入:from package import function
2.复杂数据类型的初次接触:tuple、list、dictionary
3.语法糖:数据的交换可以用a,b=b,a
4.通过调用内置的QuickDraw数据包,进行绘图,对语法、变量和数字的使用进行强化练习
第三课《函数和Help函数的使用》
1.通过help方法对内置函数进行说明调用,对于自定义函数建议引入说明文档,便于后期help方法的调用
2.自定义函数中,return的使用
3.print(1,2,3,sep=' < ')中sep参数应该引起注意
4.以下使用方法

第四课《练习:函数和Help函数的使用》
1.如果想要使用某个内置函数实现一些复杂的需求,首先应该想一想,这些内置函数本事是否能够实现此需求,为此可以先使用help方法调用内置函数说明文档。例如用round函数实现保留小数点后两位,round(num,2)
2.分清语法错误、逻辑错误
第五课《布尔类型与条件语句》
2.elif的使用
3.条件判断单行语法

第六课《练习:布尔类型与条件语句》
1.语法糖

2.热狗配料选择问题的条件判断
1)全加

2)全不加

3)只加一种

3.Blackjack问题
规则如下:
1)每局开始阶段,发给玩家两张牌,两张牌均正面朝上;发给庄家两张牌,一张正面朝上,一张正面朝下
2)之后玩家和庄家依次选择继续摸牌还是不摸,如果玩家手牌总点数超过21,则称为潽了,庄家赢,反之也对
3)当玩家和庄家的点数均超过17时,只有玩家大于庄家的点数才算赢,小于或等于庄家的点数均算输
4)牌点对应规则:J、Q、K=10;2-10=2-10;A=11(总点数小于21时);A=1(如果把A算作11,总点数大于21时);没有大小王
目标:为玩家制定规则,提高其胜率
一种解决方案(来自 Wye Low):

1次测试结果:

50000次测试结果:

第七课《列表》
1.列表的表示、赋值、索引、切片技巧,例如选取最后三个元素:list[-3:]
2.作用于列表的函数:len、sorted、max、sum、any,可使用help函数进行查询
3.列表对象(object)的属性(attribute)与方法(method),方法主要介绍了append,pop,index。可以通过help(list)的方法对列表list的可用方法进行查询
4.元组的表示及其不可变性,通常用在函数需要返回多个变量时
第八课《练习:列表》
1.列表赋值和切片在一起的情况值得注意,如list[1,2,3][1:],实际长度为2
2.要善于利用index方法
第九课《循环及列表的深入理解》
1.for与列表、元组、字符串组合使用,for与range组合使用
2.while与终止条件的组合
3.列表的循环赋值
第十课《练习:循环及列表的深入理解》

第十一课《字符串与字典》
1.字符串的单双引号使用,双引号可以包含单引号,单引号也可以包含双引号,也可以使用转移符"\"实现


转义符的基本规则

2.print中end参数的运用
3.字符串的方法,upper、lower、index、startswith、endswith、split、join、isdigit等
4.重点关注format方法的使用

5.字典的一些常用方法,keys、values、items
第十二课《练习:字符串与字典》
1.len("\n")是1而不是0
2.“Data scientists spend 80% of their time cleaning data, and 20% of their time complaining about cleaning data.”


4.掌握字典的增删改查
第十三课《使用外部库》


第十四课《练习:使用外部库》
略
网友评论