Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
array change
#6
The function doesn't require any prior knowledge of the len of a or any of the row (lists) in a. It uses len() to get that information.

From the output it looks like out of range indices should "wrap-around". From your example a[-1] changes to a[2] and a[3] changes to a[0]. You should read up about lists and how it handles different index values. You'll need something that checks the range of the index values and does the wrap-around when needed.
Reply


Messages In This Thread
array change - by svm - Jun-21-2022, 01:19 PM
RE: array change - by deanhystad - Jun-21-2022, 02:16 PM
RE: array change - by svm - Jun-21-2022, 03:02 PM
RE: array change - by deanhystad - Jun-21-2022, 03:57 PM
RE: array change - by svm - Jun-21-2022, 04:06 PM
RE: array change - by deanhystad - Jun-21-2022, 10:09 PM
RE: array change - by svm - Jun-23-2022, 01:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Change a numpy array to a dataframe Led_Zeppelin 3 1,175 Jan-26-2023, 09:01 PM
Last Post: deanhystad
Question Change elements of array based on position of input data Cola_Reb 6 2,226 May-13-2022, 12:57 PM
Last Post: Cola_Reb
  LIST or ARRAY Comparison and change of value nio74maz 0 1,730 Dec-21-2020, 05:52 PM
Last Post: nio74maz
  change array elements dependent on index SchroedingersLion 1 2,252 Nov-22-2019, 06:25 AM
Last Post: scidam
  change array column values without loop khalidreemy 2 3,890 May-05-2019, 09:05 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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