r/pythonhelp • u/[deleted] • Jun 08 '21
Can anybody help me with this script? In the output panel, it is supposed to send the coordinates of the 'k,' but it instead sends random numbers (Wherever I put the 'k'). However, for example, it is at (3, 3), but (0, 2) shows up in the output regardless of how many times I run it.
2
Upvotes
1
u/MrPhungx Jun 08 '21
In arrays and lists you start counting the index at 0. Therefore a row or column has the Indizes 0, 1, 2. So the position of k in your screenshot is the row 0 and the column 2 which results in (0,2).
3
u/Akshaykadav Jun 09 '21
The output that you get is correct indexing starts at 0 in almost all programming launguages. To get a user friendly location you can just add
+1toiandjand the output should now be(1,3)so the 1st row and the third column.