已采纳回答 / drinkey
通俗的说,你的代码中L代表一个list,没有什么实际意义,仅仅是命名,你写成a也行。调用的时候传递进来的实际值是一个list,就可以work,如果变成一个字符串或者数字,或者不可迭代的值,就raise exception了。
2015-02-03
给的答案生成的是:[2, 12, 30, 56, 90, 132, 182, 240, 306, 380, 462, 552, 650, 756, 870, 992, 1122, 1260, 1406, 1560, 1722, 1892, 2070, 2256, 2450, 2652, 2862, 3080, 3306, 3540, 3782, 4032, 4290, 4556, 4830, 5112, 5402, 5700, 6006, 6320, 6642, 6972, 7310, 7656, 8010, 8372, 8742, 9120, 9506, 9900]
10/4 整数
余数全部去掉。。
a = 10.0 / 4
b = 2.5
print a+b
print 2.5 + (10.0 / 4)
余数全部去掉。。
a = 10.0 / 4
b = 2.5
print a+b
print 2.5 + (10.0 / 4)
2015-02-03
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''
Whether it's nobler in the mind to suffer.'''
2015-02-03
原tuple中是三个元素,如果变为t=('a','b','A','B')就变为四个元素。。。
2015-02-03
>>>print r'''"To be,or not to be":that is the question.
...Whether it's nobler in the mind to suffer.'''
...Whether it's nobler in the mind to suffer.'''
2015-02-02
t = ('a', 'b', "['A', 'B']")
list改为字符串不知道符合不
list改为字符串不知道符合不
2015-02-02