for name,score in zip(d.keys(),d.values()):
print name+":"+str(score)
print name+":"+str(score)
2016-09-05
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:',d.get('Adam')
print 'Lisa:',d.get('Lisa')
print 'Bart:',d.get('Bart')
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:',d.get('Adam')
print 'Lisa:',d.get('Lisa')
print 'Bart:',d.get('Bart')
2016-09-05
t = ('a', 'b', ('A', 'B'))
#刚才试过t=('a','b','A','B'),但是这样就不对了,上面这t是有三个元素,而这种元素变成了四个,也就是说把一个list类型的元素变成了A、B两个元素所以不一样
print t
#刚才试过t=('a','b','A','B'),但是这样就不对了,上面这t是有三个元素,而这种元素变成了四个,也就是说把一个list类型的元素变成了A、B两个元素所以不一样
print t
2016-09-05
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop(2)
L.pop(2)
print L
这个不对?
L.pop(2)
L.pop(2)
print L
这个不对?
2016-09-05
耿直如我
L = ['Adam', 'Lisa', 'Bart']
L[0] = 'Bart'
L[2] = 'Adam'
print L
L = ['Adam', 'Lisa', 'Bart']
L[0] = 'Bart'
L[2] = 'Adam'
print L
2016-09-04
L = ['Adam', 'Lisa', 'Bart']
tem = L[-1]
L[-1] = L[0]
L[0] = tem
print L
tem = L[-1]
L[-1] = L[0]
L[0] = tem
print L
2016-09-04
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop(2)
L.pop(2)
print L
L.pop(2)
L.pop(2)
print L
2016-09-04
L = ['Adam', 'Lisa', 'Bart']
L[0]='Bart'
L[-1]='Adam'
print L
L[0]='Bart'
L[-1]='Adam'
print L
2016-09-04
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-09-04