for score in d.itervalues():
if score>=60:
tds = ['<tr><td>%s</td><td>%s</td></tr>' % (name, score)for name, score in d.iteritems()]
else:
tds = ['<tr><td>%s</td><td style="color:red">%s</td></tr>' % (name, score)for name, score in d.iteritems()]
if score>=60:
tds = ['<tr><td>%s</td><td>%s</td></tr>' % (name, score)for name, score in d.iteritems()]
else:
tds = ['<tr><td>%s</td><td style="color:red">%s</td></tr>' % (name, score)for name, score in d.iteritems()]
2019-03-28
# -*- coding: utf-8 -*-
print r'''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
这样才行。。。。 不能加u ,加了u会报错
print r'''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
这样才行。。。。 不能加u ,加了u会报错
2019-03-28
print r'''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
2019-03-27
if-else系列只有一个会执行,如果想两个都执行那就写两个if就行了,不要用if-else
2019-03-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')
2019-03-26
def average(*args):
length = len(args)
if length == 0:
return 0.0
s = float(sum(args))
return s/length
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
length = len(args)
if length == 0:
return 0.0
s = float(sum(args))
return s/length
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2019-03-26
L = ['Adam', 'Lisa', 'Bart']
t=L[0]
L[0]=L[2]
L[2]=t;
print L
t=L[0]
L[0]=L[2]
L[2]=t;
print L
2019-03-25
def firstCharUpper(s):
return s[:1].upper()+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
return s[:1].upper()+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
2019-03-25