2

When I write print("Hello", "world") the output should be Hello world, however what I am getting is ('Hello', 'world') I understand that this has something to do with the Python version, where in python 2 the print function did not require parentheses.

I have tried changing the python version and it is displayed as python 3.10.0, I have tried using a custom path as well as looking in other forums but can't seem to find a solution.

Peter Macej
  • 4,831
  • 22
  • 49
  • 1
    What's the result of `print(sys.executable)`? How can you confirm you have selected the python3.10? where have you got it? – Steven-MSFT Nov 04 '21 at 01:44
  • I solved the problem since so if you are here to help thanks but I managed to switch versions in the end. If you have this problem yourself then here is how I did it: https://stackoverflow.com/questions/69833055/change-the-version-to-python-3-in-virtual-studio-code-vs-code-if-code-runner-u – Alexandre Nakicen Nov 04 '21 at 19:16

1 Answers1

1

This is because, as you said, you use an old version of Python. To find a solution, try with:

print("Hello " + "world")

The output will be:

>>> Hello world
Ruggero
  • 427
  • 2
  • 10