Print statement not printing as it suppose to

John Gordon gordon at panix.com
Fri Sep 20 18:40:00 EDT 2013


In <05bbf1a3-6480-48ee-8984-2482b90c79c0 at googlegroups.com> Sam <anasdahany at gmail.com> writes:

> print("\nThe total amount required is ", total )

> OUTPUT

> ('\nThe total amount required is ', 3534)

In older versions of python (like the one you are using), 'print' is a
statement instead of a function.

In other words, it is used like this:

    name = "Bob"
    print "Hello ", name

Because there are parentheses around the text to be printed, your version
of python is interpreting it as a tuple.  Remove the parentheses and you
should be ok.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list