廖雪峰python3练习题三

 

 

条件判断

题目:

 

答案:

 1 #!/usr/bin/env python3
 2 #-*- coding:utf-8 -*-
 3 
 4 heigth = 1.75
 5 weigth = 80.5
 6 
 7 bim = weigth / (heigth * heigth)
 8 print(bim)
 9 
10 if bim < 18.5:
11     print('过轻')
12 elif bim > 18.5 and bim < 25:
13     print('正常')
14 elif bim > 25 and bim < 28:
15     print('过重')
16 elif bim > 28 and bim < 32:
17     print('肥胖')
18 elif bim > 32:
19     print('严重肥胖')

 

posted @ 2018-08-02 20:25  悠然现南山  阅读(444)  评论(0编辑  收藏  举报