Q:

Python rule of for statement

I just began learning Python.  So I am a beginner.  I have a question about "for statement."  I think I still don't know the rule of it. 
Please see below. 
example:
list1 = []
list2 = []

def forStatement():
    for i in range(3):
        for j in range(5, 7):
            list2.append(j)
        list1.append(list2)
    return list1

The result I am looking for is;
[[5, 6], [5, 6], [5, 6]]

But when I run that code, it turns out like this. 
[[5, 6, 5, 6, 5, 6], [5, 6, 5, 6, 5, 6], [5, 6, 5, 6, 5, 6]]

Can anyone help me?  How can I get that result? 
Thank you so much. 

A:

You are almost correct, the only problem with your code is that you keep adding elements to list2.  Instead, you should create a new list every time:
list1 = []

for i in range(3):
    list2 = []
    for j in range(5, 7):
        list2.append(j)
    list1.append(list2)

