tds = [ generate_tr for name, score in d.iteritems()]
if score<60:
print <tr><td>%s</td><td>%s</td><td style="color:red"></tr>' % (name, score)
print '<table border="1">'
print '<tr><th>Name</th><th>Score</th><tr>'
print '\n'.join(tds)
print '</table>'
if score<60:
print <tr><td>%s</td><td>%s</td><td style="color:red"></tr>' % (name, score)
print '<table border="1">'
print '<tr><th>Name</th><th>Score</th><tr>'
print '\n'.join(tds)
print '</table>'
2016-05-24
import math
def quadratic_equation(a, b, c):
if (b*b-4*a*c)<0:
print 'no slove'
else:
x1=(-b+math.sqrt(b*b-4*a*c))/(2*a)
x2=(-b-math.sqrt(b*b-4*a*c))/(2*a)
return x1,x2
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)
def quadratic_equation(a, b, c):
if (b*b-4*a*c)<0:
print 'no slove'
else:
x1=(-b+math.sqrt(b*b-4*a*c))/(2*a)
x2=(-b-math.sqrt(b*b-4*a*c))/(2*a)
return x1,x2
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)
2016-05-23
L = ['Adam', 'Lisa', 'Bart']
L[0]='Bart'
L[-1]='Adam'
print L
L[0]='Bart'
L[-1]='Adam'
print L
2016-05-23
print [a*100+b*10+c for a in range(1,10) for b in range(0,10) for c in range(1,10)if a==c]
2016-05-23
# -*- coding: utf-8 -*-
print r'''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
print r'''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
2016-05-23
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.''''
Whether it's nobler in the mind to suffer.''''
2016-05-23