if score < 60:
return '<tr><td>%s</td><td style="color:red">%s</td></tr>' % (name, score)
return '<tr><td>%s</td><td>%s</td></tr>' % (name, score)
return '<tr><td>%s</td><td style="color:red">%s</td></tr>' % (name, score)
return '<tr><td>%s</td><td>%s</td></tr>' % (name, score)
2018-07-24
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for k, v in d.iteritems():
sum = sum + v
print k+':'+str(v)
print 'average', ':', sum/len(d)
sum = 0.0
for k, v in d.iteritems():
sum = sum + v
print k+':'+str(v)
print 'average', ':', sum/len(d)
2018-07-24
x1 = 1
d = 3
n = 100
x100 = x1 + (n-1)*d
s = (x1+x100)*50
print s
d = 3
n = 100
x100 = x1 + (n-1)*d
s = (x1+x100)*50
print s
2018-07-24
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:',d['Adam']
print 'Lisa:',d['Lisa']
print 'Bart:',d['Bart']
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:',d['Adam']
print 'Lisa:',d['Lisa']
print 'Bart:',d['Bart']
2018-07-23
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2 == 0:
continue
sum = sum + x
print sum
x = 0
while True:
x = x + 1
if x > 100:
break
if x%2 == 0:
continue
sum = sum + x
print sum
2018-07-23
sum = 0
x = 1
while x < 100:
sum = sum + x
x = x + 2
print sum
x = 1
while x < 100:
sum = sum + x
x = x + 2
print sum
2018-07-23
return (-b+math.sqrt(b**2-4*a*c))/(2*a), (-b-math.sqrt(b**2-4*a*c))/(2*a)
2018-07-23
L = []
n=1
while n<=100:
L.append(n*n)
n+=1
def sum(L):
s=0
for x in L:
s+=x
return s
print sum(L)
n=1
while n<=100:
L.append(n*n)
n+=1
def sum(L):
s=0
for x in L:
s+=x
return s
print sum(L)
2018-07-23
# -*- coding: utf-8 -*-
print '''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
print '''静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
2018-07-23
def area_of_circle(x):
return 3.14 * x * x
print area_of_circle(2)
return 3.14 * x * x
print area_of_circle(2)
2018-07-23