s = 'Python was started in 1989 by "Guido".\n\tPython is free and easy to learn.'
print s
print s
2019-03-13
L = ['Adam', 'Lisa', 'Bart', 'Paul']
R = range(1,5)
X = zip(R,L)
for index, name in X:
print index, '-', name
我觉得我这样写比他这种要容易理解多了。
R = range(1,5)
X = zip(R,L)
for index, name in X:
print index, '-', name
我觉得我这样写比他这种要容易理解多了。
print [x+y+z for x in '123456789' for y in'0123456789'for z in '123456789'if x==z]
2019-03-13
print [x+y+x for x in '123456789' for y in'0123456789']
2019-03-13
sum = 0
x = 1
n = 1
while True:
sum=sum+x
x=x*2
n=n+1
if n>20:
break
print sum
x = 1
n = 1
while True:
sum=sum+x
x=x*2
n=n+1
if n>20:
break
print sum
2019-03-12
t = ('a', 'b', ('A', 'B'))
print t
print t
2019-03-12
关于print(key,‘:’,d[key])和print(key+‘:’+str(d[key]))的区别:用,间隔的会有一个空格,+连接的没空格
2019-03-12
L = [75, 92, 59, 68]
sum = 0.0
for score in L:
sum+=score;
print sum/len(L)
sum = 0.0
for score in L:
sum+=score;
print sum/len(L)
2019-03-12
L = ['Adam', 'Lisa', 'Bart']
L[0]='Bart'
L[-1]='Adam'
print L
L[0]='Bart'
L[-1]='Adam'
print L
2019-03-12
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop(2)
L.pop(2)
print L
L.pop(2)
L.pop(2)
print L
2019-03-12