Can anyone please help me in understanding the following python code
Joshua Landau
joshua.landau.ws at gmail.com
Thu May 30 07:11:38 EDT 2013
On 30 May 2013 11:19, <bhk755 at gmail.com> wrote:
> Also, Can you please let me know how did you found out that I am using Python 2 Interpreter.
Do you have access to a Python3 interpreter? If so, try running it and
your output will look like:
Splitting [54, 26, 93, 17, 77, 31, 44, 55, 20]
Splitting [54, 26, 93, 17]
Splitting [54, 26]
Splitting [54]
Merging [54]
Splitting [26]
Merging [26]
... BLAH BLAH BLAH
Which is obviously much nicer. This is how Chris knew the code was
written for Python3. Therefore I would suggest you use Python3 - not
all code runs on both!
The "proper" way to write the prints for Python2 is without the brackets:
print "Merging ",alist
But the methods Chris and I have used work the same on both so are
probably better in this case. They're more complicated, though.
More information about the Python-list
mailing list