Coded Correspondence - How to See My Output

Hello!

I’ve just started coded correspondence on VS Code. Is there anyway to see my output in VS Code to test my code or should I be pushing to GitHub and viewing it in an internet browser?

I’d really appreciate any help!

You can open the terminal on VS Code.

For example, in terminal →

$ python3 hello.py

            ^
            |
            |
     Your File Name
1 Like

Is this Python based? You could open the in-built terminal and run your file, ViewTerminal and simply run it like python /path/to/myfile.py replacing that with your actual path to the file or a relative path.

There are also debugging options but you might want to look at the set-up first before using them:

1 Like

Thanks! I don’t know why that’s not working for me. In the terminal I’m typing:

python/

and then pasting the relative path to file. I also tried just the path but they are both returning error messages.

why is there is a forward slash after python? that makes it look like a directory, not the python executable/interpreter.

please include these error messages, that provides us with a lot more information to help you

Oh! My mistake! Thanks for pointing it out. So did the following and received the following message:

C:\Users\Vicky> python C:\Users\Vicky\Downloads\coded_correspondence\coded_correspondence\coded_correspondence.ipynb
Traceback (most recent call last):
** File “C:\Users\Vicky\Downloads\coded_correspondence\coded_correspondence\coded_correspondence.ipynb”, line 24, in **
** “execution_count”: null,**
NameError: name ‘null’ is not defined

Is this an error message to do with the code now?!

Those notebooks (typically using .ipynb as their extension) are not simple python scripts but a rather complex mixture of json, markdown and python and they shouldn’t be run like a script with python name.ipynb.

They can be run in vs code but you may have an easier time running it in your browser instead using jupyter. Are you following any guidance for this project? Is there an introduction to jupyter notebooks?

Maybe double check the guidance for your project and look at the following-
https://www.codecademy.com/articles/how-to-use-jupyter-notebooks-py3

1 Like

Yes! I downloaded Jupyter. So I wasn’t supposed to use VS Code at all? Thanks for the link and I’ll read the guidance more carefully…

1 Like