def wordjumble(Wordlist, Hintlist, score):
wordchoice = getword(Wordlist, Hintlist)
high = len(wordchoice)
low = -len(wordchoice)
for i in range(10):
position = random.randrange(high,low)
print wordchoice[position]
score = wordguess(wordchoice, score)
return score
我收到一个值错误,我的任务是获取高低之间的随机数。我的错误在哪里?
这是回溯:
Traceback (most recent call last):
File "E:\Programming\Python\Worksheet 15\test.py", line 54, in
wordjumble(Wordlist, Hintlist, score)
File "E:\Programming\Python\Worksheet 15\test.py", line 49, in wordjumble
position = random.randrange(high,low)
File "E:\Portable Python 2.7.2.1\App\lib\random.py", line 217, in
randrange raise ValueError, "empty range for randrange() (%d,%d, %d)"
% (istart, istop, width) ValueError: empty range for randrange() (7,-7, -14)