Print statement not printing as it suppose to

Chris Angelico rosuav at gmail.com
Fri Sep 20 22:50:32 EDT 2013


On Sat, Sep 21, 2013 at 7:57 AM, Sam <anasdahany at gmail.com> wrote:
> car=int(input("Lamborghini tune-up:"))
> print("\nThe total amount required is ", total )
> OUTPUT
> ('\nThe total amount required is ', 3534)

As others have said, this output indicates that you're running under a
Python 2.x interpreter. I strongly recommend you switch to running
under Python 3.x - do not take the simple advice that might make it
work in both, because you have other differences which will trip you
up. In Python 2, the input function is extremely dangerous and should
be avoided: it *evaluates* its argument. (If you really *want* to
evaluate something, you can call the eval() function explicitly. You
don't want it to be hidden behind the innocuously-named input().)
Download Python 3.3 (or later) and start using that; you'll find it's
by far the better interpreter - years of improvements on top of the
version you're using there.

ChrisA



More information about the Python-list mailing list