Q:

Elements in .join

I've created a grid formatted string by doing this
ls1 = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"]
ls2 = ["16", "17", "*", " ", "*", "*", "*", " ", " ", " ", " ", " ", " ", " ", "*"]
ls3 = ["*", " ", "*", " ", "*", " ", " ", " ", " ", " ", " ", " ", " ", " ", "*"]
ls4 = ["*", "W", " ", "F", "*", " ", " ", " ", " ", " ", " ", " ", " ", " ", "*"]
ls5 = ["*", " ", "F", "W", "*", " ", " ", " ", " ", " ", " ", " ", " ", " ", "*"]
ls6 = ["*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "Y", "*", "*"]

ls = []
ls.append(ls1)
ls.append(ls2)
ls.append(ls3)
ls.append(ls4)
ls.append(ls5)
ls.append(ls6)

grid_string = ""
for sublist in ls:
    grid_string += "".join(sublist)+ "\n"

and now I want to replace elements of grid_string with new strings but I'm not sure how elements are counted in this grid like format. So I've made the first row (ls1) integers in ascending order and two integers in the second row (ls2) to test it.
I basically did:
print(grid_string[3])
print(grid_string[4])
print(grid_string[5])
print(grid_string[6])
print(grid_string[7])
print(grid_string[8])
print(grid_string[9])
print(grid_string[10])
print(grid_string[11])
print(grid_string[12])

The output seemed logical for the first 6 prints but then the rest doesn't make much sense.
Here's what the output looked like:
4
5
6
7
8
9
1
0
1
1
1
2
1
3

A:

Your ending output(grid_string) was the following
123456789101112131415
1617* ***       *
* * *         *
*W F*         *
* FW*         *
************Y**

Thus, the output is correct:
print(grid_string[3])   #4 
print(grid_string[4])   #5 
print(grid_string[5])   #6 
print(grid_string[6])   #7 
print(grid_string[7])   #8
print(grid_string[8])   #9 
print(grid_string[9])   #1 of the "10"
print(grid_string[10])  #0 of the "10" 
print(grid_string[11])  #1 of the "11" 
print(grid_string[12])  #1 of the "11"

When you used the string.join() method they were no longer ints and hence you were never going to get back 10 and 11

