Brake usage in the loop

I have trouble in understanding the below code.

1,How to understand [0 for _ in range(10)]? i know it is used to create a list with ten zero. but how to interpret this list comprehension? how to write it in the for loop? maybe it will be easier to understand.

2, Why we need to use break in the for loop? I thought the for loop would stop when it fisines looping. I also noticed that before we use continue in the for loop before,what is the function?

Thank you!
Screen Link:

My Code:

gr_freq_table_10 = pd.Series([0 for _ in range(10)], index = intervals)

for value in wnba['PTS']:
    for interval in intervals:
        if value in interval:
            gr_freq_table_10.loc[interval] += 1

What I expected to happen:

What actually happened:

Replace this line with the output/error


I just copy-paste your code and it works fine for me: you just have to check that you put freq=60 in:

intervals = pd.interval_range(start = 0, end = 600, freq = 60)

Your “What actually happened” block is wrong in your post, so it’s more difficult to help you.

The break command is here to force the code to stop the for look when gr_freq_table_10.loc[interval] += 1.

Indeed it’s useless to finish the for loop in this case since value cannot be in two different interval.