Mar-07-2020, 01:32 AM
Hello, I need to make a list of 10 random numbers. A simple way is the following
I thought something like
from random import random newlist = [] for i in range(10): newlist.append(random())I was looking to make it more elegant (e.g. without using variable i).
I thought something like
newlist2 = [random()]*10but this of course makes the same numbers. Is there any other way?