Creating and saving a text file for a Battleship Game in Python
<p>I have been working on the same battleship game for quite a while now and am getting to the end stages. Now i need to have the game save the top five scores in a text file using the function def saveScore. I then need it to read the file that i just created and print the scores onto the python code using try and except for file open and close. I dont know how to get python to recognize my variable score because i believe its only local. Here's what i have. I do not know how to use pickle.</p>

<pre><code>def main():
    board=createBoard()
    printBoard(board)
    s = [[21,22,23,24,25],
    [45,55,65,75],
    [1,2,3],
    [85,86,87],
    [5,15],
    [46,56]]
    playBattleship(s,board)
main()
</code></pre>
