L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop(2)
'Paul'
print L
L = ['Adam', 'Lisa', 'Bart']
L.pop(2)
'Bart'
print L
我这样过了~~ 不知道对不对?~—~
L.pop(2)
'Paul'
print L
L = ['Adam', 'Lisa', 'Bart']
L.pop(2)
'Bart'
print L
我这样过了~~ 不知道对不对?~—~
2015-09-13
L.pop(3)
L.pop(2)
也可以达到效果,先删最后一个,再删第三个
或者是
L.pop(-2)
L.pop(-1)
再或者
L.pop(-1)
L.pop(-1)
都可以达到要求
L.pop(2)
也可以达到效果,先删最后一个,再删第三个
或者是
L.pop(-2)
L.pop(-1)
再或者
L.pop(-1)
L.pop(-1)
都可以达到要求
2015-09-13
def move(n, a, b, c):
if n==1:
print a,'-->',c
return
else:
move(n-1,a,c,b)
move(1,a,b,c)
move(n-1,b,a,c)
move(2, 'A', 'B', 'C')
if n==1:
print a,'-->',c
return
else:
move(n-1,a,c,b)
move(1,a,b,c)
move(n-1,b,a,c)
move(2, 'A', 'B', 'C')
2015-09-13
因为在python中,0 空字符串,以及None都看做是False,其他数值和非空的字符串看作是True
短路计算规则:当为与运算时,a and b 如果,a为false,那么结果为false ,不再运算b的结果,a为true是,要看b的结果,
当为或运算时,a or b 如果 a为true,那么结果为true,不再运算b的结果,a为假时,要看b的结果。
短路计算规则:当为与运算时,a and b 如果,a为false,那么结果为false ,不再运算b的结果,a为true是,要看b的结果,
当为或运算时,a or b 如果 a为true,那么结果为true,不再运算b的结果,a为假时,要看b的结果。
2015-09-13
真想不明白这教程为什么不使用py3。现在的库基本上都支持3了,不支持的基本上是没人管不更新的了,只有少数还在更新。py3有很多很好的新特性,而py2是不会再更新新特性,只会安全维护了
2015-09-12
a赋值python,打印hello,b赋值空,如果 a 是 False,则整个计算结果必定取决于 b,因此返回 b。打印world,输出就是hello world。
2015-09-12
x1 = 1
d = 3
n = 100
x100 = x1+d*(n-1)
s = x1*n+(n*(n-1)*d)/2
print s
d = 3
n = 100
x100 = x1+d*(n-1)
s = x1*n+(n*(n-1)*d)/2
print s
2015-09-12