"print()" is producing undesired output in Visual Studio Code

I have written a Python 3 code, which is:

i = int(input("enter number: "))
print("enter",i)

I'm expecting an output as:

enter number: 5
enter 5

However, I'm getting this:

enter number: 5
('enter', 5)

What could be the issue? How can I rectify this?


Solution 1:

You are using Python 2. To use Python 3 you need to change the Python interpreter in Visual Studio Code. See instructions on Using Python Environments in Visual Studio Code You need to go to command pallete and use python:select interpreter and select Python 3 interpreter.

In Python 3 you should get the following output.

enter number: 7
enter 7