I'm trying to form several lists, and sort values of another list into each of these based on a conditional.
I have the following:
b_421, b_521, b_621, b_721, b_821, b_921, b_1021, b_1121, b_1221, b_1321, b_1421, b_1520 = ([] for i in range(12))
for n in x_list:
    if n < float(421):
        b_421.append(n)
    elif float(421) <= n < float(521):
        b_521.append(n)
    elif float(521) <= n < float(621):
        b_621.append(n)
    elif float(621) <= n < float(721):
        b_721.append(n)
    elif float(721) <= n < float(821):
        b_821.append(n)
    elif float(821) <= n < float(921):
        b_921.append(n)
    elif float(921) <= n < float(1021):
        b_1021.append(n)
    elif float(1021) <= n < float(1121):
        b_1121.append(n)
    elif float(1121) <= n < float(1221):
        b_1221.append(n)
    elif float(1221) <= n < float(1321):
        b_1321.append(n)
    elif float(1321) <= n < float(1421):
        b_1421.append(n)
    elif float(1421) <= n < float(1520):
        b_1520.append(n)
However, my lists all contain all of the elements from the original list x_list.
What am I doing wrong?
EDITED:
Even if I define my lists in the following way:
b_421=[]
b_521=[]
b_621=[]
b_721=[]
b_821=[]
b_921=[]
b_1021=[] 
b_1121=[] 
b_1221=[] 
b_1321=[] 
b_1421=[] 
b_1520=[]
I still get b_421 to contain all the numbers within my original list. The original list was created from a pandas dataFrame column, could this be the issue?
x_list = df['col1'].tolist()
The only way I get this to give me my desired output, which is each list containing the values within the desired ranges, is if I define the lists individually as I did above and then create a separate for, if combo for each list. As so:
for n in x_list:
    if n < float(421):
        b_421.append(n)
for n in x_list:
    if float(421) <= n < float(521):
        b_521.append(n)  
for n in x_list:        
    if float(521) <= n < float(621):
        b_621.append(n)
for n in x_list:  
    if float(621) <= n < float(721):
        b_721.append(n)
for n in x_list:  
    if float(721) <= n < float(821):
        b_821.append(n)
for n in x_list:  
    if float(821) <= n < float(921):
        b_921.append(n)
for n in x_list:  
    if float(921) <= n < float(1021):
        b_1021.append(n)
for n in x_list:  
    if float(1021) <= n < float(1121):
        b_1121.append(n)
for n in x_list:  
    if float(1121) <= n < float(1221):
        b_1221.append(n)
for n in x_list:  
    if float(1221) <= n < float(1321):
        b_1321.append(n)
for n in x_list:  
    if float(1321) <= n < float(1421):
        b_1421.append(n)
for n in x_list:  
    if float(1421) <= n < float(1520):
        b_1520.append(n)
This is insane to me - maybe my environment is just broken?
 
     
    