I used this code to make a list of float
values ranging from 0 to 1:
whole_list = [random.random() for n in range(count)]
I want to group them into two lists big_list
and small_list
, so that big_list
contains the values from whole_list
that are greater than 0.5, and small_list
contains the values less than 0.5
How can I do this in Python?
UPDATE: Solution is as follows:
for n in whole_list:
if n > cutoff:
big_list.append(n)
else:
small_list.append(n)
print(big_list)
print(small_list)