Why won't my code from "Battleship!" run in PyCharm?

Hi, I am currently done with my “Battleship!” lesson in the Python course, and I wanted to keep experimenting with my code in PyCharm. However, when I paste the code it return errors, can someone please explain me why? Thank you!

In stackoverflow.com they have a special index Python PyCharm
google search
== discussions / opinions ==
Python PyCharm python vs pycharm site:stackoverflow.com
for instance