我试图用 random.shuffle 处理 python 并且它一直给我一个错误,有人可以帮我弄清楚它有什么问题。
# [import statements]
import q1fun
# [constants]
# [rest of program code]
number = input("howmany cards to you want dealt?")
a = q1fun.deal(number)
print (a)
# [import statements]
import random
# [constants]
def deal(x):
y = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
a = random.shuffle(y(x))
return(a)
您要发多少张牌?5 Traceback(最近一次通话最后一次):文件“C:\Users\Eddie\workspace\cp104\durb8250_a16\src\q1.py”,第 18 行,a = q1fun.deal(number)文件“C:\Users\Eddie\workspace\cp104\durb8250_a16\src\q1fun.py”,第 29 行,在交易中 a = random.shuffle(y(x)) TypeError: 'list' object is not callable