I've got a bit of a problem. I've got a test tomorrow in python programming, and I've been learning the language using 3.1. The computers we're taking the test on all have 2.6 installed. They're Linux (not very familiar with Unix).

Obviously this is troublesome. I don't want to spend half of the allotted time figuring out changes between 3.1 and 2.6. I emailed my professor but he didn't offer much help. Said he didn't have install rights on the computers. He did however suggest that I install 3.1 on my "home area", it's a 100mb personal space that gets mounted every time I log in on a university computer.

So, my questions are as follows:
-Can I install Python 3.1 to my "home area" even though I don't have install rights on the computer (or any uni computers)? (Probably not)
-If so, how do I do it? (Almost never use Linux)
-How do I let the computer know what version I want to use when I test a .py file?
-Are there any other solutions I haven't considered? (portable python? only 3.0 available, but will it serve my purpose?)

I'm guessing this won't work out smoothly, so I'll probably have to do the test in 2.6. Some major differenced I've noticed so far between the two versions are:
print doesn't need () in 2.6
input is raw_input in 2.6
a.split() is string.split(a) in 2.6

Are there any other crucial changes I need to know about? Keep in mind that this is basic programming, nothing too advanced.

Thanks for reading.

input is raw_input in 2.6

That's the only big difference along with Tkinter becoming tkinter. For print you can use either
print str
print(str)

and string.split(a) has been deprecated for while for all versions of Python, so use a.split() in all versions as well. There should be very few problems using 2.6 as it is a transition version that handles syntax either way in most cases.

The best solution is that you do the test with 2.6. Some library modules have different names, for example html.parser in python3 is HTMLParser in 2.6, but most of your programs should run.

Okay, thanks. I've got time to try out some 2.6 code before tomorrow, so I should be ok :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.