我在Python中编写了一个生成随机数的程序
import random
num = [x for x in range(1000)]
random.shuffle(num)
num
但我决定让用户输入大小/最大数字,如下所示:
import random
xx= input("please Enter the max")
xx= int(xx)
num = [x for x in range(xx)]
random.shuffle(num)
num
你能告诉我我该怎么处理它?</ p>
感谢
答案 0 :(得分:0)
我弄清楚了这个错误,我只是在代码中添加了print(nums)并获得了输出
import random
xx= input("please Enter the max")
xx= int(xx)
num = [x for x in range(xx)]
random.shuffle(num)
print(nums)