How do I read 1 value from a list
LukeShomper (50)

Can Pop(0) be used or something like Getting 1 value from a list
or should I use something like
Tea = ["Bob", "Ross", "Has", "Tea"]
And like print(FromTeaGet(0))
And then the console would say
And if I did print(FromTeaGet(1))
The console would say
I have googled it and am still confuused

You are viewing a single comment. View All
mwilki7 (1112)

If you want to get a value from a list use brackets list[index]
Popping from a list means removing either from the front or back of the list (depending on how the list is coded)

        Mage[0] Mage[1] Mage[2] Mage[3]
            |       |       |       |
            |       |       |       |
            v       v       v       v
Mage = [    100,    100,    50,     50]

                Mage[0] Mage[1] Mage[2]                     new list of size 1
                    |       |       |                               |
                    |       |       |                               |
                    v       v       v                               v
Pop(): Mage = [    100,    100,    50]   Popped the end off! -->  [50]
LukeShomper (50)

@mwilki7 Kinda confused would It be
or is it mage[index]
bit confused
because I don't know the syntax trying to figure it out

LukeShomper (50)

Like, give me an example; Code so I can copy past and see how it works and like learn something new :D

mwilki7 (1112)

Say you want to show everything inside the mage list (make sure the spelling/capitalization is correct):

for item in Mage:

Or using a for range loop

for i in range(0, len(Mage)):

Or maybe you just want to get something from a certain index:

myHP = Mage[0]