鱼C论坛

 找回密码
 立即注册
查看: 1082|回复: 3

[已解决]2

[复制链接]
发表于 2020-9-20 12:42:41 | 显示全部楼层 |阅读模式
1鱼币
想要右边的一直查询,按下e结束
我这个一直是B


x=int(input('please a num:'))
while x!='e':
    if 0<=x<=100:
        if x==100:
            print('S')
        else:
             if x>=90:
                print('A')
             else:
                if x>=80:
                    print('B')
                else:
                    if x>=60:
                        print('C')
                    else:
                        print('D')

    else:
        print('input error')


"""score = input("请输入你的分数:")
score = int(score)

if score < 60:
    print("D")
   
if 60 <= score < 80:
    print("C")

if 80 <= score < 90:
    print("B")

if 90 <= score < 100:
    print("A")

if score == 100:
    print("S")"""
最佳答案
2020-9-20 12:42:42
循环里加入input
  1. x=input('please a num:')
  2. while x!='e':
  3.     x=int(x)
  4.     if 0<=x<=100:
  5.         if x==100:
  6.             print('S')
  7.         else:
  8.              if x>=90:
  9.                 print('A')
  10.              else:
  11.                 if x>=80:
  12.                     print('B')
  13.                 else:
  14.                     if x>=60:
  15.                         print('C')
  16.                     else:
  17.                         print('D')
  18.         x = input('please a num:')
  19.     else:
  20.         print('input error')
  21.         x = input('please a num:')
  22. else:
  23.     print('退出')
复制代码
if else.png

最佳答案

查看完整内容

循环里加入input
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-9-20 12:42:42 | 显示全部楼层    本楼为最佳答案   
循环里加入input
  1. x=input('please a num:')
  2. while x!='e':
  3.     x=int(x)
  4.     if 0<=x<=100:
  5.         if x==100:
  6.             print('S')
  7.         else:
  8.              if x>=90:
  9.                 print('A')
  10.              else:
  11.                 if x>=80:
  12.                     print('B')
  13.                 else:
  14.                     if x>=60:
  15.                         print('C')
  16.                     else:
  17.                         print('D')
  18.         x = input('please a num:')
  19.     else:
  20.         print('input error')
  21.         x = input('please a num:')
  22. else:
  23.     print('退出')
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-9-20 13:00:41 | 显示全部楼层
楼上说的对。不过可以再美观一点。
  1. x = input('please a num:')
  2. while x != 'e':
  3.     x = int(x)
  4.     if x < 0 or x > 100:
  5.         print('input error')
  6.     elif x == 100:
  7.         print('S')
  8.     elif x >= 90:
  9.         print('A')
  10.     elif x >= 80:
  11.         print('B')
  12.     elif x >= 60:
  13.         print('C')
  14.     else:
  15.         print('D')
  16.     x = input('please a num:')
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-9-20 14:37:00 | 显示全部楼层

nb
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-26 23:47

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表