0

Hi

I am struggling with assigning values to a list of a list.

This is my full code.

```
import random
#get user input as to size of range
range_size = 0
if range_size == 0:
try:
range_size = int(input('Size of Range?: '))
except ValueError:
print('That was not an integer!')
range_size = 0
#set base value for each number in range_size
base_value = int(100 / range_size)
print(base_value)
#create list of base values
num_weighted = [base_value] * range_size
num_weighted[0] = round(base_value * 2.2, 1)
num_weighted[1] = round(base_value * 1.8, 1)
num_weighted[2] = round(base_value * 1.8, 1)
num_weighted[3] = round(base_value * 1.5, 1)
num_weighted[4] = round(base_value * 1.4, 1)
num_weighted[5] = round(base_value * 1.3, 1)
# redistribute the difference of top 6 and rest of range
top6 = (sum(num_weighted[0:6]))
not_top6 = range_size - 6
pts_alloc = round((100 - top6) / not_top6, 1)
num_weighted[6:] = [pts_alloc for i in range(len(num_weighted) - 6)]
keys = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight',
'Nine', 'Ten', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen']
dictionary = dict(zip(keys, num_weighted))
print(dictionary)
#my_sample = random.sample(random.choice(dictionary), 3)
#print(my_sample)
#def mySamples(dictionary):
# """Call sets of 3, 5 times"""
#total_weight = sum(dictionary.values())
#n_items = 3
#random_sample = list()
d_mod = dict(dictionary)
user_range = (range(5))
arr = [[] for _ in user_range]
for y in range(3):
b = tuple(random.choice(d_mod))
arr[y].append(b)
print(arr)
```

It's the very last bit I can't do. I am using random choice to pull my weighted values out, and I want to assign them my list. I want the amount of lists and the length of the lists to be variable so don't want to hard code the assignment.