On Tue, Dec 11, 2018 at 09:07:58PM +0530, Asad wrote:
> Hi All,
>
> I used your solution , however found a strange issue with deque :
No you haven't. You found a *syntax error*, as the exception says:
> >>> print 'Deque:', d
> File "<stdin>", line 1
> print 'Deque:', d
> ^
> SyntaxError: invalid syntax
which means the error occurs before the interpreter runs the code. You
could replace the above line with any similar line:
print 'Not a deque', 1.2345
and you will get the same error.
When you are faced with an error in the interactive interpreter, you
should try different things to see how they effect the problem. Does the
problem go away if you use a float instead of a deque? If you change the
string, does the problem go away? If you swap the order, does the
problem go away? What if you use a single value instead of two?
This is called "debugging", and as a programmer, you need to learn how
to do this.
[...]
> In python 2.6 print statement work as print "Solution"
> however after import collection I have to use print with print("Solution")
> is this a known issue ?
As Peter says, you must have run
from __future__ import print_function
to see this behaviour. This has nothing to do with import collection.
You can debug that for yourself by exiting the interactive interpreter,
starting it up again, and trying to print before and after importing
collection.
--
Steve
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor