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.