Python Forum
I’m Flat out struggling to understand list indexes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I’m Flat out struggling to understand list indexes
#1
Let’s say
x = [0, 1, [2]] 

x[2][0] = 3

print(x) 
I found this in a book I was scanning through, ok so I’m still trying to understand how this works because it was my understanding that if you used square brackets in this manner the code
Would pull from the 3rd item and the 1st element of said item [2][0] but that doesn’t seem to be what is going on here ,How is x[2][0] = 3 coming out to be [0,1,[3]] ?
Reply


Messages In This Thread
I’m Flat out struggling to understand list indexes - by gr3yali3n - Jul-17-2020, 06:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Comparing List values to get indexes Edward_ 7 1,083 Jun-09-2023, 04:57 PM
Last Post: deanhystad
  Replace columns indexes reading a XSLX file Larry1888 2 951 Nov-18-2022, 10:16 PM
Last Post: Pedroski55
  Struggling with Juggling JSON Data SamWatt 7 1,820 May-09-2022, 02:49 AM
Last Post: snippsat
  Syntax errors: Struggling to setup enviroment and load packages AH56 5 2,724 Jun-30-2021, 01:01 PM
Last Post: AH56
  Struggling for the past hour to define function and call it back godlyredwall 2 2,158 Oct-29-2020, 02:45 PM
Last Post: deanhystad
  struggling with != statements CallumRoberts2004 2 1,509 Aug-18-2020, 03:01 PM
Last Post: GOTO10
  How to print array indexes? Mark17 6 2,686 Aug-03-2020, 04:26 PM
Last Post: Mark17
  Struggling with nested list gr3yali3n 3 2,257 Jul-09-2020, 05:30 PM
Last Post: DPaul
  Understand list comprehension and draw PUP280 9 3,888 Apr-23-2020, 05:25 PM
Last Post: PUP280
  Struggling to exit this while loop fatherted99 5 2,412 Feb-08-2020, 07:46 PM
Last Post: fatherted99

Forum Jump:

User Panel Messages

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