Change Workspace Language

I was wondering if there was a way to change my workspace bash from running Python 3 to Python 2. I just finished the entire Python 2 lesson and am currently on a pro trial. My projects from the lesson are all written in Python 2 but cannot run in the workspace because I believe it takes Python 3 error arguments.
Is there a way to change this?
Is there a point in continuing to write in Python 2 or should I begin learning Python 3? I assume they have similar fundamentals.
Any help would be great, sorry if my diction was confusing, it is probably obvious I am a novice lol.
Thanks.

Python2 will not be supported any longer and is deprecated as of Jan. 1, 2020
https://www.python.org/doc/sunset-python-2/

You can set python3 as your default if that’s what you’re saying.

echo "alias python='python3'" >> .bashrc source .bashrc

See:

We are all novices at some point. Don’t worry about it! We learn something new every day. :slight_smile:

2 Likes

It can’t hurt to be familiar with Python 2, at least to look at it. Not a lot of point diving deeply into it, though.

If you are looking at code and you see,

print "Hello World!"

user = raw_input("Enter a number ")

print range(10)

print filter(lambda x: x < 0, lst)

among other suspicious looking code, you’re looking at Python 2.

print was then only a construct. It is now a function.

print ("Hello World!")

raw_input() is deprecated and unsupported in Python 3.

user = input("Enter a number: ")

Iterators in Python 2 returned a list. Now they return an object.

print (list(range(10))

print (list(filter(lambda x: x < 0, lst))

Those are some of the basic differences that stand out. It helps to know if you’re looking at old code, or new. Not that big a deal, though. Python 2 is slowing disappearing into the sunset.

3 Likes