Hi, I wanted to put the Battleship code we learnt from Codecademy and play around with it on Pycharm. May I know which version of Python we're learning now on Codecademy?
2.7.3 is the version of python codecademy uses.
Thank you very much!
for battle ship there are two things you will need to tweak to make the code of the exercise work in pycharm (which i guess is python3), if so, all print statements require parentheses:
print("parentheses are required in python3")
raw_input no longer exist, this is now
You'll only need to make a few slight changes to get the current version running in Python 3.
print "---" becomes print ("---")
raw_input('...') becomes input('...')
raw_input is deprecated.
That should be all that needs changing, if I recall correctly.
@stetim beat me to the punch. Leaving it anyway.
Thank you all so much. I installed both versions on my computer and I think I'll try to redo it in Version 3. I seemed to also be having a problem with from random import randint, somehow it doesn't recognize this.
Can't see why not, it works fine in IDLE.
>>> from random import randint >>> randint(0,100) 54 >>>
Listed in the random module
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.