dehavu 发表于 2022-11-5 23:49:38

求助代码没错但是报错

报错信息:
Traceback (most recent call last):
File "C:/Users/dehavu_/Desktop/22222222.py", line 4, in <module>
    answer = random.randint(18.24)
TypeError: Random.randint() missing 1 required positional argument: 'b'

代码:
'''111111111111111111 '''
import random
t = 10
answer = random.randint(18.24)

while t > 0:
    temp = input('11111111111111:')
    guess = int(temp)
   
    if guess == answer:
      print('5555555555555111111111111111111111111111111111111111111')
    else:
      if guess > answer:
            print('444444444444441111111111111111111111111111111111111111111')
      else:
            print('333333333333333331111111111111111111111111111111111111111')
            
while t == 0:
    print('22222222222222222111111111111111111111111111111111111')

hrpzcf 发表于 2022-11-5 23:56:49

answer = random.randint(18, 24)
是逗号,不是点号

zhangjinxuan 发表于 2022-11-13 11:57:22

answer = random.randint(18.24)
中间有一个小数点,把小数点改成逗号:
answer = random.randint(18,24)
页: [1]
查看完整版本: 求助代码没错但是报错