Python Diaries: "Writing My First Code In Python"

Every programmer's first step is to write the classic "Hello, World!" program. Let's do this. To write our first Python program we need an IDE (Integrated Development Environment). There are several IDE like PyCharm, Spyder, Jupyter Notebook, VSCode, Atom, Sublime Text, etc. Every IDE comes with its own feature but I like VSCode the most. But sometime we will use other IDEs too.

Let's download VSCode

Downloading VSCode is a piece of cake. Here are step-by-step instructions to download Visual Studio Code (VS Code):

  1. Open your web browser and go to the official VS Code website: code.visualstudio.com

  2. Once you're on the website, you'll see a prominent download button. Click on it.

  3. Once the download is finished, locate the downloaded file. The filename will vary based on your operating system.

    • For Windows: Look for a file with a ".exe" extension, such as "VSCodeSetup.exe".

    • For macOS: Locate a file with a ".dmg" extension, like "VSCode-darwin-stable.dmg".

    • For Linux: The downloaded file will have a ".deb" or ".rpm" extension, depending on your distribution.

  4. Double-click the downloaded file to start the installation process.

  5. Follow the installation instructions provided by the installer. The process typically involves agreeing to the terms and conditions, selecting the installation location, and choosing additional options like adding VS Code to the system PATH.

  6. Once the installation is complete, you can launch Visual Studio Code. Look for the VS Code icon in your applications or desktop. Double-click the icon to open the application.

Congratulations! We have successfully downloaded and installed Visual Studio Code on our computer. Let's open VSCode and write our first line of code.

Let's write our first line of code with Python

Before writing anything let's select a folder where we will save our Python files. I have created a folder on my computer named "Python Files". Let's open the folder and right-click with the mouse in the empty space. From the dialogue box select open with code.

It will open the VSCode. Now click on the new file button and name it with .py extension.

We have created our first Python file. Now we can write code.

print("Hello World")

Write this code on the file and now run the code by clicking the run button or you can use the keyboard shortcut Ctrl+Alt+n.

The output will be shown in the terminal.

In Python, the "print" keyword is used to display or output text or values to the console. It allows us to showcase information, variables, or any desired output during the execution of a program.
Now we can write Python programs in our VSCode. The environment is set up successfully.