need help understanding these lines of code! what I have here is 3 sub population: 10, 30, and 50 each normally distributed with their respective std dev and mean as shown: for e.g.: sub population 10 would have a std dev of 3000 and mean 10,000. what I want to do is to conduct random sampling of these sub population and put the results in a list I named "sample". question is: did I code my objective correctly in the line of sample += np.random.normal(mean_List[I], std_list[I], sub_pop[I]).tolist()?
sub_pop = [10, 30, 50]
std_list = [3000, 5000, 8000]
mean_list = [10000, 15000, 30000]
sample = []
for i in range(len(sub_pop)):
sample += np.random.normal(mean_list[i],std_list[i], sub_pop[i]).tolist()
sample1 = [abs(x) for x in sample]
print(sample1)
print(np.median(sample1))

