This type of error happens when the operating system is trying to directly execute a Python file, but does not have an indicator that it is a Python file. In Unix and Linux, unlike Windows, the file extension (.py for Python, but also any other) - is just perfumery. The operating system looks at the first few bytes of the file to understand what kind of file it is, and in case of script files, call the correct interpreter.
In short, put the below line as the first line of your Python script:
#! /usr/bin/env python3
Ready, this tells the operating system that it should use the "env" program to find out which program is correct in the current environment to run a script in python3.
This will fix your specific error, but there may still be another configuration error in your vscode - it should know, regardless of the operating system, that your script is in Python, and call the appropriate interpreter (I do not know tell whether the vscode looks at the file extension or what it does). The error you put in is more common when you run a Python program from the terminal.