第八条main(rand1)中if判断语句出现报错

来源:3-2 项目作业

MrNeal1203

2019-06-08 00:36:12

出现报错:'<' not supported between instances of 'int' and 'NoneType'


def main(rand1):
   temp = 0
   while True:
       k = int(input('请继续输入您猜测的数字:'))
       print('*'*10)
       if check_num_legal(k) == True:
           print('对不起您输入的数字未在指定区间!!!')
           continue
       else:
           if k < rand1:
               print('Lower than the answer')
           elif k > rand1:
               print('Higher than the answer')
               temp += 1
           else:
               print('恭喜你!只用了{}次就赢得了游戏'.format(temp))

写回答

1回答

时间,

2019-06-08

同学,你好。部分代码无法判断具体错误,希望同学提供全部代码,方便更好的为您解决问题。

0

0 学习 · 8160 问题

查看课程