用py编辑的小型分数显示器

print("---小型分数器---")

shuzi = input("请输入一个数字:")
while not shuzi.isdigit():
    shuzi = input("格式错误输入数字:")
while int(shuzi) > 100:
    shuzi = input("数字超出范围:")

shuzi1 = int(shuzi)
if shuzi1 > 90:
    print("A")
elif (shuzi1 >= 90) and (shuzi1 > 80):
    print("B")
elif (shuzi1 >= 80) and (shuzi1 > 70):
    print("C")
elif (shuzi1 >= 70) and (shuzi1 > 60):
    print("D")
else:
    print("E")

 

实现功能:自动检测输入数字范围、自动判断是否为数字

posted @ 2017-11-30 12:15  类十三  阅读(172)  评论(0编辑  收藏  举报