(https://i.sstatic.net/4O8ajzLj.png)
So I saw a tutorial about how to set your vscode to use python. I had to install Anaconda, and on vscode I installed python extension. On the video the guy also sets the terminal to run as bash and not the usual terminal. Buuut when i create a simple function like the photo, after clicking on run, and then, call the function on the bash terminal like hi(), it doesn't even return something. But if I write to print something, it shows on the bash terminal.
I tried to run python functions and was not able to call this function in the bash terminal, only prints works.
Example:
vtorp@blabla ~/OneDrive/Área de Trabalho/Teste python $ x()
x() bash: syntax error near unexpected token `x'
Check out this SO question. The reason you are not able to run your program is because you are not running you're program. I'll elaborate. Also, just letting you know, bash is the usual terminal. VSCode probably uses bash. Here is an askubuntu question about that. Anyway, to run the program, run it from the python interpreter:
bash$ python(3)
>>> from file import x
>>> x()
or run it from the file itself.
def x():
...
x()
Run that file with python(3) {{file_name}}
. Note that you have to be in the same directory as the file.
Happy Coding!!