print is statement in Python 2, and brackets around single value do nothing, so basically both are Ok in Python2. In Python3 print is function, which is usefull. The same style of printing can be activated in Python2 by
from __future__ import print_function
So the first version fails in Python3. I generally use future import and Python3 print style, but if you do not want to confuse newbies in both versions, you can use single parameter bracketed prints, and can consentrate in subject matter withput concerm of Python versions if subject matter itself is compatible.
because print is a statement and the expression ("foo") has the same value as the expression "foo". On the other hand the statements
print "foo", "bar"
print ("foo", "bar")
are not equivalent because ("foo", "bar") is a single expression which value is a tuple of length two, so the first statement prints two strings while the second statement prints a tuple containing two strings.
In python 3, print() is a function, so print "foo" and print "foo", "bar" are syntax errors. The parenthesis in print ("foo", "bar") are ordinary function call parenthesis, they don't mean build a tuple and two strings are printed. To print the same tuple in python 3, one must write print(("foo", "bar")).
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.