0
返回4这是我的代码:试图让蟒蛇,随机混合列表mycolours,但要蟒蛇仅从列表
def main():
mycolours = ['R', 'G', 'B', 'Y', 'P', 'O']
myguess = 'RGBY'
total_guess = 5
x = random.shuffle(mycolours[:4])
for i in range(total_guess):
if myguess == x:
print('CORRECT')
else:
print('TRY AGAIN')
main()
代替x
从列表中返回4个随机字符串,它返回一个值没有。
所以你的代码不工作?你有什么问题? –
这个问题呢? https://stackoverflow.com/questions/33578220/how-do-i-get-python-to-randomly-return-4-letters-from-a-list –
@kevinGuan没有x不返回四个随机字符串,而是它返回一个没有的值 – terriyon