Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flipping matrices problem
#9
(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 Dance , was scratching my head Think so long for this.
Thanks a million! So glad I joined this forum. [Image: Cc8niZI]
Reply


Messages In This Thread
Flipping matrices problem - by Qmohankumar0017 - Feb-20-2019, 03:52 PM
RE: Flipping matrices problem - by ichabod801 - Feb-20-2019, 04:03 PM
RE: Flipping matrices problem - by Qmohankumar0017 - Feb-20-2019, 04:04 PM
RE: Flipping matrices problem - by ichabod801 - Feb-20-2019, 04:26 PM
RE: Flipping matrices problem - by Qmohankumar0017 - Feb-20-2019, 04:44 PM
RE: Flipping matrices problem - by ichabod801 - Feb-20-2019, 05:19 PM
RE: Flipping matrices problem - by Qmohankumar0017 - Feb-20-2019, 05:30 PM
RE: Flipping matrices problem - by ichabod801 - Feb-20-2019, 05:37 PM
RE: Flipping matrices problem - by Qmohankumar0017 - Feb-20-2019, 06:00 PM
RE: Flipping matrices problem - by ichabod801 - Feb-20-2019, 06:44 PM
RE: Flipping matrices problem - by buran - Feb-20-2019, 06:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  4D matrices ali1almakhmari 0 798 Jun-13-2022, 09:21 AM
Last Post: ali1almakhmari
  Unable to use Pauli Matrices in QNET Package Rupayan 2 1,977 Sep-25-2021, 06:02 AM
Last Post: Rupayan
  Python: Automated Script to Read Multiple Files in Respective Matrices Robotguy 7 4,394 Jul-03-2020, 01:34 AM
Last Post: bowlofred
  Application of dilute matrices chris_drak 0 1,385 Mar-29-2020, 03:04 PM
Last Post: chris_drak
  Partial "visual" Matching of matrices masteripper 15 5,550 Nov-03-2019, 05:41 PM
Last Post: masteripper
  flipping the for loop in file juniorcoder 2 2,292 Oct-21-2018, 01:47 PM
Last Post: wavic
  matrices math problem lokoprof 1 2,261 Aug-27-2018, 07:48 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020