print L[None]
# TypeError: list indices must be integers, not NoneType
还是要-1
# TypeError: list indices must be integers, not NoneType
还是要-1
2016-02-02
a = 'python'
print 'hello,', a or 'world' # hello, python
b = ''
print 'hello,', b or 'world' # hello, world
print 'hello,', a or 'world' # hello, python
b = ''
print 'hello,', b or 'world' # hello, world
2016-02-02
print 2.5 + 10 / 4
print 2.5 + 10.0 / 4
print 2.5 + float(10) / 4
print 2.5 + 10.0 / 4
print 2.5 + float(10) / 4
2016-02-02
s = 'Python was started in 1989 by "Guido".\npython is free and easy to learn.'
print s
print s
2016-02-02
L = []
for a in range(1,10):
for b in range(0,10):
for c in range(0,10):
if(a==c):
L.append(a*100+b*10+c)
print(L)
for a in range(1,10):
for b in range(0,10):
for c in range(0,10):
if(a==c):
L.append(a*100+b*10+c)
print(L)
2016-02-02
sum = 0
x =0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
if x>100:
break
sum+=x
print sum
x =0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
if x>100:
break
sum+=x
print sum
2016-02-02
sum = 0
x =0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
sum+=x
print sum
x =0
while True:
x = x + 1
if x > 100:
break
if x%2==0:
continue
sum+=x
print sum
2016-02-02