score = raw_input("score:") score=int(score) if(score >= 90) and (score <= 100): print "A" elif(score >= 80) and (score < 90): print "B" elif(score >= 60) and (score < 80): print "C" else: print "D"
i = 5 if i > 1: print 'i bigger than 1' print 'good' if i>2: print 'i bigger thatn 2' print 'even better'
python中没有switch语句, switch可以使用if...elif...else实现。
if, elif, else之后必须要有冒号(:), 之后的代码需要增加一层缩进。