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
def quadratic_equation(a, b, c):
x1 = (-1*b+math.sqrt(b*b-4*a*c))/(2*a)
x2 = (-1*b-math.sqrt(b*b-4*a*c))/(2*a)
return x1,x2
x1 = (-1*b+math.sqrt(b*b-4*a*c))/(2*a)
x2 = (-1*b-math.sqrt(b*b-4*a*c))/(2*a)
return x1,x2
2015-09-25