s = set(['Adam', 'Paul']) 'Lisa' is not exist in set
2015-03-03
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key+':'+str(d[key])
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key+':'+str(d[key])
2015-03-03
for x in range(1,9):
for y in range(2,10):
if x<y:
print x*10+y
for y in range(2,10):
if x<y:
print x*10+y
2015-03-02
#coding:utf-8
def move(n, a, b, c):
if n ==1:
print a, '-->', c
else:
move(n-1, a, c, b) #将前n-1个从A移动到B
print a, '-->', c #将第n个从A移动到C
move(n-1, b, a, c) #将前n-1个从B移动到C
def move(n, a, b, c):
if n ==1:
print a, '-->', c
else:
move(n-1, a, c, b) #将前n-1个从A移动到B
print a, '-->', c #将第n个从A移动到C
move(n-1, b, a, c) #将前n-1个从B移动到C
2015-03-02
L = ['Adam', 'Lisa', 'Bart']
L[2]='a'
L[0]='Bart'
L[2]='Adam'
print L
L[2]='a'
L[0]='Bart'
L[2]='Adam'
print L
2015-02-28