Python Forum
Reading one value from an array in reverse
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading one value from an array in reverse
#1
Take this array: [[100, 200, 0], [100, 300, 1], [100, 400, 2]]
It can be split into three things: [position1, position2, message]
I can reverse the main array using the [::-1], but when I read from it, and use that data, the result is the same.
Is there a way I can read just the last value from my array in reverse.
So, if I print the current array it is:
Output:
[100, 200, 0] [100, 300, 1] [100, 400, 2]
but when I reverse just the last value, it will be:
Output:
[100, 200, 3] [100, 300, 2] [100, 400, 1]
How can I achieve this?

Thanks,
Dream
Reply


Messages In This Thread
Reading one value from an array in reverse - by DreamingInsanity - May-03-2019, 05:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Indexing [::-1] to Reverse ALL 2D Array Rows, ALL 3D, 4D Array Columns & Rows Python Jeremy7 8 7,231 Mar-02-2021, 01:54 AM
Last Post: Jeremy7
  while loop reading list in reverse Jerry51 1 1,595 Apr-24-2020, 12:44 PM
Last Post: deanhystad
  Reading data from serial port as byte array vlad93 1 12,123 May-18-2019, 05:26 AM
Last Post: heiner55
  Need help with reading input from stdin into array list Annie123 2 5,100 Mar-24-2019, 01:19 PM
Last Post: Annie123

Forum Jump:

User Panel Messages

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