Python script running


can i run the scripts of python which i am learning here in python3 and if yes then how


nope, you can’t. I wouldn’t recommend doing that either way, given there is validation at codecademy’s side at each exercise, which would unnecessary slow your script execution

You can install python on your PC, or use sites like


You can adjust your code where python2 and python3 differ, a good start is to simply run it and see where/if it crashes. If you just want to run it, install python2 as well, and use that for your python2 code.


Whilst working through the Learn Python exercises, I have also had python 3.x open, I’d run the code in Codecademy first, then I’d run some code offline in Python 3.x on my computer. I found this very helpful to help me learn, as I was able to see how the code works when I’m doing it on my computer. There are some differences in the syntax between Python 2.x (which Codecademy uses) and Python 3.x
In codecademy, you print as follows:
print value
In Python 3.x, you print as follows:
This will only work in Codecademy if you add the code:

from __future__ import print_function

Kindly pointed out by @ionatan

Another key difference, when you want a user input, in codecademy is as follows:
In Python 3.x:
This won’t work in codecademy, but that’s okay, just remember to changed raw_input() to input() when running the code offline :slight_smile:
These are the major differences between the two that I found, other than that, the majority of code from the tutorials will run as normal.

If you’re interested in other differences between the two, then the following links has other examples and further explanation:

I hope this helps!


You should not use print(value) when print is a statement, it’s only misleading, it’s not a function, and if you have multiple arguments it won’t behave at all right.

BUT the print function is backported to 2.7:

from __future__ import print_function
print(1, 2, 3)  # 1 2 3    not (1, 2, 3)
print(print)    # <built-in function print>

This might break exercises that look at the output, using the print function might make those not see the print (might work though)

Similarly, the new behaviour of / is also backported:

from __future__ import division
print 3 / 2  # 1.5    not 1

(Should use // for integer division in both versions anyway)

One can also do:

import sys
if sys.version_info.major < 3:
    input = raw_input
    range = xrange

Also, super important to note that it’s the things being done that are important and difficult. Syntax is trivial.


I was unaware of using print(value) potentially causing problems, so far it’s been fine for me, though I’ll stop that in Codecademy, thank you though! :slight_smile:


It won’t. Not by itself.

But it’s like how 5 is equal to (5) or ((((5)))) and my reaction to that is… probably best described as: ??? what do you mean

Multiple arguments to functions and the print statements differ though, so print(value, value) mean different things depending on whether print is a function or a statement


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.