哎 自己写的通不过
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for name,value in d.items():
print "%s:%d" % (name,value)
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for name,value in d.items():
print "%s:%d" % (name,value)
2015-09-28
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop()
L.pop()
print L
我这样的也过了
L.pop()
L.pop()
print L
我这样的也过了
2015-09-28
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for item in d.values():
sum = sum + item
print sum/len(d)
sum = 0.0
for item in d.values():
sum = sum + item
print sum/len(d)
2015-09-27
L = list(range(1, 101))
print(L[0:10])
print(L[2::3])
print(L[4:50:5])
print(L[0:10])
print(L[2::3])
print(L[4:50:5])
2015-09-27
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59 }
def generate_tr(name, score):
str=''
if(score<60):
str=' style="color:red"'
return '<tr><td>%s</td><td%s>%s</td></tr>' % (name,str, score)
显示对的但是没通过。。。
def generate_tr(name, score):
str=''
if(score<60):
str=' style="color:red"'
return '<tr><td>%s</td><td%s>%s</td></tr>' % (name,str, score)
显示对的但是没通过。。。
2015-09-27
不能理解出题的,这样也行
L = [95.5,85,59,59]
print L[0]
print L[1]
print L[2]
print L[3]
L = [95.5,85,59,59]
print L[0]
print L[1]
print L[2]
print L[3]
2015-09-26
def firstCharUpper(s):
return s[0].upper()+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
return s[0].upper()+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
2015-09-26