9. python 条件判断

1. if 

age = 20

if age > 10:
        print 'yes'

2. if else 

age = 20

if age > 20:
    print 'old'
else:
    print 'young'

3. if elif else

score = 85

if score >= 90:
    print 'excellent'
elif score >= 80:
    print 'good'
elif score >= 60:
    print 'passed'
else:
    print 'failed'

 

posted @ 2017-03-17 01:11  涵叔  阅读(115)  评论(0编辑  收藏  举报