Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54517

Re: Print statement not printing as it suppose to

From John Gordon <gordon@panix.com>
Newsgroups comp.lang.python
Subject Re: Print statement not printing as it suppose to
Date 2013-09-20 22:40 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <l1iis0$itm$1@reader1.panix.com> (permalink)
References <05bbf1a3-6480-48ee-8984-2482b90c79c0@googlegroups.com>

Show all headers | View raw


In <05bbf1a3-6480-48ee-8984-2482b90c79c0@googlegroups.com> Sam <anasdahany@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@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Print statement not printing as it suppose to Sam <anasdahany@gmail.com> - 2013-09-20 14:57 -0700
  Re: Print statement not printing as it suppose to Tim Delaney <timothy.c.delaney@gmail.com> - 2013-09-21 08:11 +1000
  Re: Print statement not printing as it suppose to Emiliano Carlos de Moraes Firmino <emiliano.firmino@gmail.com> - 2013-09-20 18:11 -0400
  Re: Print statement not printing as it suppose to John Gordon <gordon@panix.com> - 2013-09-20 22:40 +0000
  Re: Print statement not printing as it suppose to Chris Angelico <rosuav@gmail.com> - 2013-09-21 12:50 +1000
  Re: Print statement not printing as it suppose to Dave Angel <davea@davea.name> - 2013-09-21 04:40 +0000

csiph-web