• 虽然在之前接触过C、C++、Java等,但是还是觉得Python写出来的好看o(≧v≦)o~,简洁明了!
    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"
    

      

  •   if语句的嵌套
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之后必须要有冒号(:), 之后的代码需要增加一层缩进。