Feb-20-2019, 06:00 PM
(Feb-20-2019, 05:37 PM)ichabod801 Wrote: You need to change line 2. n = m[:]
means that n is a different list than m. However, n[0] is still the same list as m[0]. With the vertical flip, you are only modifying n, so it doesn't mess with m. But with the horizontal flip, you are changing n[0], which changes m[0], and thereby changes the overall m. You've got the right technique with the default slice [:], but you need to apply it to each sub-list of m.
Oh I totally forgot about memory management in python while solving this tricky problem.
So now I split every sublist in m and assigned that to corresponding new list and it worked.
Finally I am so relieved , was scratching my head so long for this.
Thanks a million! So glad I joined this forum.