Search code examples
pythonaptanaaptana3

Printing tuple instead of three strings


I am trying to learn python, so I downloaded aptanaStudio3 and this happens.

Code:

print('One', 'Two', 'Three')

Output:

('One', 'Two', 'Three')

it should print just

One Two Three

Solution

  • Python 2 has print as a command, so all you need is

    print 'One', 'Two', 'Three'
    

    In Python 3, print is a function, so the parentheses are required for the call.

    In most contexts, the series of values in parentheses is a tuple; this is just like a list, except that you can't change the individual elements (i.e. a tuple is immutable).