d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59 }
def generate_tr(name, score):
if score < 60:
return '<tr><td>%s</td><td style="color:red">%s</td></tr>' % (name, score)
else:
return '<tr><td>%s</td><td>%s</td></tr>' % (name, score)
def generate_tr(name, score):
if score < 60:
return '<tr><td>%s</td><td style="color:red">%s</td></tr>' % (name, score)
else:
return '<tr><td>%s</td><td>%s</td></tr>' % (name, score)
2015-09-06
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for i in d.values():
sum = sum + i
print sum / len(d) #len(d) be noted
sum = 0.0
for i in d.values():
sum = sum + i
print sum / len(d) #len(d) be noted
2015-09-06
print [int(str(m)+str(n)+str(m)) for m in range(1,10) for n in range(0,10)]
2015-09-06
print [ m * 100 + n * 10 + m for m in range(1,10) for n in range(0,10) ]
2015-09-06
最新回答 / 粤川_shu
s = 'Python was started in 1989 by \"Guido\".\nPython is free and easy to learn.'print s排列成一行,不要断开
2015-09-05
已采纳回答 / 11届西华牛饮客
#字符串和元组是不可更改的str='hello'#你可以重新给str赋值,因为它是变量是可更改的str='world'#但你不能这样,因为str[0]是一个字符串,是不能更改的str[0]='H'<...code...>
2015-09-05