Day01-15/03.分支结构.md

修改练习2,提示错误的输入成绩
pull/351/head
gshnu777 2019-10-30 09:29:50 +08:00 committed by GitHub
parent 00a3941355
commit 35fb665eb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -118,7 +118,9 @@ Author: 骆昊
"""
score = float(input('请输入成绩: '))
if score >= 90:
if score >100 or score < 0:
grade = 'F'
elif score >= 90:
grade = 'A'
elif score >= 80:
grade = 'B'
@ -128,6 +130,10 @@ elif score >= 60:
grade = 'D'
else:
grade = 'E'
if grade == 'F':
print('请检查输入成绩有效性!')
else:
print('对应的等级是:', grade)
```
#### 练习3输入三条边长如果能构成三角形就计算周长和面积。