0
我有這樣的代碼:的Python 3.4導入列表的功能
list1 = []
def funct1(list1):
numb1 = *random number generated*
list1 = list1.append(numb1)
print (list1)
funct1()
我期待數追加到列表中。當我第二次運行該功能時,該號碼在列表中,另一個號碼將被添加到列表中。
都能跟得上。你不在這個代碼中的任何地方迭代。所以你不會得到那個錯誤。 – thefourtheye
*問題究竟是什麼*?使用這樣的列表是個不錯的主意,但它會起作用。 – jonrsharpe
@thefourtheye改變了問題 –