- 博客(2)
- 收藏
- 关注
原创 生成包含值的列表_逻辑基础_20190609
squares = [] for value in range(1,11): squares.append(value**2) print(squares) 1.想要创造一个列表,思路是先创建一个空的列表,然后往空的篮子里塞东西 2.创造的时候,一般是批量创造,批量操作,所以for循环可以应用在创造中 3.append的好处是可以使代码简洁一些,直接可以在括号内进行运算 ...
2019-06-09 22:27:33
140
1
转载 For循环执行更多操作的意义_逻辑基础_20190609
magicians = ['Alice','David','Gary'] for magician in magicians: print(magician.title() + ', that was a great trick!') print("I can't wait to see your next trick " + magician.title() + ".\n") ...
2019-06-09 18:16:21
475
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人