First Steps in Python

Making your first steps in Python with simple print() operations.

#Hashtag and Run!

Let’s open our first Jupyter Notebook.

If you are working locally with the VS User Interface, press Ctrl+Shift+P to open the command palette and search for > Create: New Jupyter Notebook. Here, VS Code automatically creates the first code block for you.

Try to enter this line of code:

print('Welcome to Python')

To run the block of code you can press Shift+Enter. Now the interface will ask you for your Python interpreter. Here you have to chose local your miniconda virtual environment or online Pytho(n Interpreter)Pyodide). Then you can run your code.

You can also comment your code to make it easier to understand for other and yourself. Python treats the hashtag character, #, in a special way. It will not compile anything that follows a # on a line. This makes hashtags very useful for adding comments and annotations to your code. You will be able to read the comments, but your computer will pass over them.

# This is a comment. Comments are very helpful
# when you want to describe what's going on in your code.
# Use them often!
This is not a comment anymore. Be careful.

print("Welcome to R")
VS Code Overview

As you see, in VS code you have many button to click on. Let’s o over the most important ones. The +Code button create a new code chunk where you can insert new code. The +Markdown button create a markdown chunk. Markdown is a lightweight markup language used to format text with simple syntax for styling, such as headers, lists, and emphasis. With markdown you can explain and structure you code in more detail. This is why Jupyter Notebook is such a convenient tool, because you can run code and explain in really detailed in one file combined.

In Markdown, headers are created using the # symbol. The number of # symbols indicates the level of the header (e.g., # for level 1, ## for level 2). Normal text is simply written without any special formatting symbols.

VS Code Markdown Cell

When clicking the little checkmark marked with the orange arrow the markdown code will be change to text format.

Updated: