Is there a way to dynamically generate new datasets from data subsets?

I am working with a dataset which reflects exam scores for students in grades 3-8 from various schools in NYC. I have manually generated six different data subsets by filtering on grade level. This process produces the desired results, but is there a way I could have done this dynamically (such as via a for loop) rather than by manually typing out each data frame title and assigning it? I ask because it involved a lot of typing for the exact same task six times over.

My code is attached.

list_of_dframes = []
for number in list(range(3,9)):
    df = df[df['grade'] == str(number)]

now to get any dataset just:


or any other number, to properly name those datasets is a bit harder…

@adam.kubalica Thank you for your response. This worked as expected.