Q:

finding coordinates in python

so i have this assignment where i'm given a "map"
island = \
['     /---------\       ',
 '     |     x    \      ',
 '     /           \--\  ',
 '    /   x            | ',
 '    |         x      | ',
 '     \               \ ',
 '      \  x  /\/\     / ',
 '       \---/    \   |  ',
 '                /--/   ']

Write a program that counts the number of treasures on the island (x marks the spot) and creates a list of coordinates, e.g. [(1,11), ...] ((1,11) is the actual location of the top treasure in the example) and then prints out a report in the form: There are 3 treasures. There is a treasure at (1,11). There is a treasure at .... Hint: start with a (very short) expression for the symbol in the ith row and the jth column.
Write a program that calculates the length of the coastline. Assume that an '-' and a '|' are 1 mile, and a '\', '/' is 1.4 miles. (This is only a very rough estimate, for many reasons, some of them mathematical).
i'm not even sure where to begin here....can anybody help me out or at the very least point me in the right direction?

A:

First thing you'll want to do is iterate over the array
for column, line in enumerate(island):
    print column, line

That gives you
0      /---------\       
1      |     x    \      
2      /           \--\  
3     /   x            | 
4     |         x      | 
5      \               \ 
6       \  x  /\/\     / 
7        \---/    \   |  
8                 /--/  

Ok, so how about iterating horizontally over each row? Exactly the same:
for column, line in enumerate(island):
    for row, cell in enumerate(line):
        print "entry at", row, column, "is", cell

Warning: gives long output!
That should be enough to get you started

