#在慕课网上的练习结果正确,我用电脑上的python3时,都把print加上括号,但是老是出错,也不知道为啥? #对python3的代码不熟呀,谁来看看该怎么把python2代码改为python3的代码 # -*- coding: utf-8 -*- d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59 } 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()] print('<table border="1">') print('<tr><th>Name</th><th>Score</th><tr>') print('\n'.join(tds)) print('</table>')
孤独的小猪