Battleship game in python
<p>I am creating a battleship game in python. I have created a board that is 10X10 and looks as such.</p>

<pre><code>-------------------------------------------------
 1 |  2 |  3 |  4 |  5 |  6 |  7 |  8 |  9 | 10 | 
-------------------------------------------------
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 
-------------------------------------------------
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 
-------------------------------------------------
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 
-------------------------------------------------
41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 
-------------------------------------------------
51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 
-------------------------------------------------
61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 
-------------------------------------------------
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 
-------------------------------------------------
81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 
-------------------------------------------------
91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100| 
-------------------------------------------------
</code></pre>

<p>Now I have a list of where the ships are located as such:
    s = [[21,22,23,24,25],
        [45,55,65,75],
        [1,2,3],
        [85,86,87],
        [5,15],
        [46,56]]</p>

<p>I am trying to write a function that allows input from the user for a spot, if the input is in the list s, it should return hit. if not it will return miss. </p>

<p>Here is what I have so far:</p>

<pre><code>def createBoard():
    board=[]
    for i in range(10):
        board.append(str(i)+" ")
    for j in range(10,100):
        board.append(j)
    return(board)
def printBoard(board):
    for i in range(0,100,10):
        print("\n"+"-"*45)
        for j in range(1,10,1):
            print(board[i+j],"|",end=" ")
    print("\n"+"-"*45)
printBoard(createBoard())

position=int(input("Choose position on the board"))
g="Miss"
a="hit"
s = [[21,22,23,24,25],
    [45,55,65,75],
    [1,2,3],
    [85,86,87],
    [5,15],
    [46,56]]
for i in range(0,len(s),1):
    if position in s[i]:
        print(a)
    elif position not in s[i]:
        print(g)
</code></pre>

<p>So far it finds whether or not the input is in the list but it returns it five times and I only want it to be returned once. I can only use basic code because I do not know much advanced work.</p>
