score=55
if score>=60:
print 'passed'
if not score>=60:
pint 'failed'
或者
score=55
if score>=60:
print 'passed'
if score<60
print 'failed'
或者
score=55
if score>=60:
print 'passed'
else:
print 'failed'
if score>=60:
print 'passed'
if not score>=60:
pint 'failed'
或者
score=55
if score>=60:
print 'passed'
if score<60
print 'failed'
或者
score=55
if score>=60:
print 'passed'
else:
print 'failed'
2016-08-20
def toUppers(L):
return [x.upper() for x in L if isinstance(x,str)==True]
print toUppers(['Hello', 'world', 101])
return [x.upper() for x in L if isinstance(x,str)==True]
print toUppers(['Hello', 'world', 101])
def toUppers(L):
return [L[i].upper() for i in range(0,len(L)) if isinstance(L[i],str)]
print toUppers(['Hello', 'world', 101])
return [L[i].upper() for i in range(0,len(L)) if isinstance(L[i],str)]
print toUppers(['Hello', 'world', 101])
已采纳回答 / 冬季的黎明3503883
2是从第三个数开始,中间的空是默认到最后一个数为止的意思,3 是每三个数取第一个数的意思,中间是不能省略的,不然就变成了从第三个数取到第四个数的意思了
2016-08-20
print [100*m+10*n+t for m in range(1,10) for n in range(0,10) for t in range(0,10) if m ==t]
#各位i注意,是三层for循环啊
#各位i注意,是三层for循环啊
2016-08-20
def generate_tr(name, score):
if score >=60:
return '<tr><td>%s</td><td>%s</td></tr>' % (name, score)
else:
return '<tr><td>%s</td><td style="color:red">%s</td></tr>'%(name,score)
tds = [ generate_tr(name,score)for name, score in d.iteritems()]
if score >=60:
return '<tr><td>%s</td><td>%s</td></tr>' % (name, score)
else:
return '<tr><td>%s</td><td style="color:red">%s</td></tr>'%(name,score)
tds = [ generate_tr(name,score)for name, score in d.iteritems()]
2016-08-20