我已附上我的代码。我希望输出为:
[675, 556, 329]
[554, 469, 784, 133]
[896, 414, 662, 826, 501]
但是我得到的输出很简单:
[321]
[32]
[342]
如何在列表中显示三项而不是仅显示一项?
我的代码是:
import random
# Create your function here
def random_number_generator(l):
number = []
length = len(number)
for length in range(0, l):
number.append(random.randrange(0,1000))
return number
print(random_number_generator(3))
print(random_number_generator(4))
print(random_number_generator(5))
答案 0 :(得分:0)
尝试一下:
def random_number_generator(l):
number = []
for length in range(0, l):
number.append(random.randrange(0,1000))
return number
答案 1 :(得分:0)
感谢您的回答。在使收益无效的同时,我还尝试了另一个运行良好的循环:
model.save('final_try.h5')