The stuff i have learned here doesn't work on IDLE 3.5. Plz send help


#1

I am learning a lot of extremely useful things here that i couldn"t learn easily anywhere else, yet i am wondering why the code I type into my IDLE 3.5 window (fresh out of code academy) is incorrect? Do i have an outdated IDLE?


Which python version?
#2

Codecademy is outdated.


#3

do you know what version CodeAcademy uses?


#4

I believe it is 2.7.3.


#5

To find out, you can do this ...

import sys
print(sys.version)

Output, in the Codecademy console ...

2.7.3 (default, Dec 18 2014, 19:10:20) 
[GCC 4.6.3]

So, @jibblyj is correct about the version.

Note the parentheses in the print statement. We need them to avoid raising an error if we have a 3.x.x version of Python.


#6

Python2 is still over the place, it's still the default Python version in most linux distributions, systems that are concerned with running the same stuff for many years on end for maintenance and stability reasons are still using Python2

There are some differences. They are small.
Google them, that's what you need to do with just about everything else anyway, this is no different. It's perhaps the single most important ability that a software developer has - to figure these things out.

Python3 would for sure be preferable but it's still something to just take in your stride. Lots of people will have asked all possible questions around this already, it's all there, a search away.

Backwards compatibility is a huge mess regardless of if it's dropped or kept.

Here, look at this perfectly valid OR operator in C:

#include <stdio.h>

int main() {
    printf("%d\n", 0 ??!??! 0); // prints 0
    printf("%d\n", 0 ??!??! 1); // prints 1
    printf("%d\n", 1 ??!??! 0); // prints 1
    printf("%d\n", 1 ??!??! 1); // prints 1
    return 0;
}

#7

what are some of the differences in syntax between 2.xx and 3.5? I started learning 3.2 or something like that off a highly rated android app (I know I know) which suprisingly served very useful. Im sure the differences are not more than slight, but it would be a great help to know to make sure.

The one thing Im noticing here is that theyre telling me to put a space and then type the string after the print function. What Ive learned in the past(and what also works on the console), is putting the string in () after print. like this: print("string") vs this site: print "string" . Whats the difference there?