Blog 3: First Program in Python: Hello World

Hello friends! Today, we are going to create our very first program in Python. Python is incredibly easy to learn, and you’ll find that you will encounter only a few errors as you start coding. Let’s dive into our topic: the "Hello World" program.

Step-by-Step Guide

  1. Open Your IDE
    For this tutorial, I will be using VSCode. Feel free to use any IDE you are comfortable with!

  2. Create a New File
    Create a new file with a .py extension. This indicates that it is a Python file.

  3. Write the Code
    In your new Python file, type the following line of code:

print("Hello World")

This line of code uses the print() function to display the text "Hello World" in the terminal.

    4. Run the Program
        You can run your program in two ways:

  • Using the Run Button: In VSCode, click the run button on the right side of the editor.
  • Using the Terminal: Open the terminal and type the following command:



python filename.py

Make sure the filename.py with the actual name of your Python file.

    5.Check the Output
        After running the program, you should see the output:

Hello World


Understanding the Code

The reason we see "Hello World" printed on the screen is due to the print() function. This function takes whatever text you provide (enclosed in double quotes) and outputs it to the terminal.

This is just the beginning! In future posts, we will explore more about Python, including how to create our own functions and much more.

Conclusion

I hope you found this tutorial helpful! If you have any questions or doubts, feel free to ask in the comments below. If you enjoyed this post, please share it with your friends to help them learn Python as well.

Best of luck on your coding journey!

Medium Blog : First Program in Python

Comments