python day 25 习题36 习题37 习题38


Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 34

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 36

习题36 设计与调试

IF尽量保持一层,尽量不嵌套

习题37 复习 各种符号

习题38 列表的操作

vscode出错了,提示node.dll找不到,以为是系统DLL缺失,最后折腾半小时,发现不是的,重启也没用。

解决的方法是,重装vscode,重装过程中盯着看,发现是在安装文件的过程中,把node.dll释放到安装文件夹中。

习题37的复习没有完全完成,

习题38主要是对列表进行操作。

pop之后就减少列表中的元素,把最后的POP走

python真是灵活,join可以直接指定连接符,直接对列表进行操作。


python day 24 习题34 习题35


Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 34

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 36

习题34主要是讲了 序数和基数

就是排列里边 位置0的元素,是第一元素

0是基数,一是序数

习题35

是将文字游戏更复杂化一些。

穿插了函数调用,输入交互。


python day 23 习题33 while循环


Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 34

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 36

for能对一些东西的集合进行循环

while可以对任何对象进行循环

可以for尽量for 更容易些

做了课后练习1,2,3,4综合代码,缩进成问题啊,贴python缩进怎么办?

# -*- coding:utf-8 -*-
“””
while i < 6:
print “At the top i is %d” % i
numbers.append(i)
i = i + 1
print “Numbers now:”, numbers
print “At the bottom i is %d” % i
“””
numbers = []
def jia(j,n):
j += n
return j
def ijia(ijia):
i = 0
while i < ijia:
print”At the top i is %d”% i
numbers.append(i)
i = jia(i,3)
print”Numbers now:”, numbers
print”At the bottom i is %d”% i
ijia = ijia(50)
print “The numbers:”
for num in numbers:
print num

python day 22 习题32 循环


Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 34

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 36

病了,躺床上两天

多看点,赶回来

1、for —in 中间的名字和 %后的变量名一致就可以。
2、for循环可以使用未定义的变量吗? 循环开始就定义了。
3、python的for可以不管个数直接枚举
4、列表和数组经典意义上是不一样的,因为实现方式不同。但python都叫列表。
5、range()  含头不含尾
>>>range(10) # 从 0 开始到 10
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> range(1, 11) # 从 1 开始到 11
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> range(0, 30, 5) # 步长为 5
[0, 5, 10, 15, 20, 25]
>>> range(0, 10, 3) # 步长为 3
[0, 3, 6, 9]
>>> range(0, –10, –1) # 负数 [0, –1, –2, –3, –4, –5, –6, –7, –8, –9]
>>> range(0)
[]
>>> range(1, 0)
[]

Python列表函数&方法

Python包含以下函数:

序号 函数
1 cmp(list1, list2)
比较两个列表的元素
2 len(list)
列表元素个数
3 max(list)
返回列表元素最大值
4 min(list)
返回列表元素最小值
5 list(seq)
将元组转换为列表

Python包含以下方法:

序号 方法
1 list.append(obj)
在列表末尾添加新的对象
2 list.count(obj)
统计某个元素在列表中出现的次数
3 list.extend(seq)
在列表末尾一次性追加另一个序列中的多个值(用新列表扩展原来的列表)
4 list.index(obj)
从列表中找出某个值第一个匹配项的索引位置
5 list.insert(index, obj)
将对象插入列表
6 list.pop([index=-1])
移除列表中的一个元素(默认最后一个元素),并且返回该元素的值
7 list.remove(obj)
移除列表中某个值的第一个匹配项
8 list.reverse()
反向列表中元素
9 list.sort(cmp=None, key=None, reverse=False)
对原列表进行排序

python day21 习题31,分支选择,小游戏


Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 34

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 36

你进入了一间黑暗的房间,里边有两扇门

你会从门里走出来吗?

类似mud游戏或这江湖游戏


python day 20 习题29,习题30 if elif else


Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 34

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 36

python里,冒号的下一行必须缩进

基本的判断练习

明天开始有些难度。


python day 19 习题27,习题28


Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 34

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 36

逻辑运算符

真值

布尔表达式

这部分,之前学习过,今天做做练习。

明天继续前进。


python day 18 习题26,基本部分的考试


Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 34

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 36

https://learnpythonthehardway.org/book/exercise26.txt

这里是考试题,基本是前边部分的集合

然后修改各种错误

按着错误提示,基本顺利过。

 


python day 17 习题25


Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 34

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 36

这一个习题主要是函数和变量的练习

ex25.py 其实相当于一个模块(module)。

python里,help(ex25)

看到的是

第一行也被认为是标题


另外,命令行里,直接打数组名,就会把数组列举出来。


python day 16 习题24,更多练习


Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 31

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 32

Notice: Undefined variable: case in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 34

Notice: Undefined variable: ex_word in /virtual/ea0177/public_html/www.mengma.pub/wp-content/themes/twentyseventeen/functions.php on line 36

笨办法学PYTHON 习题24

主要是复习转义字符

数学计算

函数

学到了一点,多个变量可以通过一个函数一次性定义

感受到:英语母语学编程太占优势了。

像我,理解例子,理解诗句,都要查字典。