Python installation was covered in the last tutorial as part of our Python for beginners series. Now It’s time to get started right away with our first program, which A straightforward introduction program that shows the phrase “Hello, World!” on the screen is the traditional “Hello, World!” application. Let’s get started.
Due to Python’s interpretive nature, as a developers we need to create Python (.py) files in a text editor and then load those files into the interpreter to run the code.
Open a Text Editor:
Open a text editor on your computer. This could be a simple text editor like Notepad on Windows, TextEdit on macOS, or any code editor like VSCode, Atom, or Sublime Text.
Write the Code:
print("Hello, World!")
This line instructs Python to display the text “Hello, World!” on the screen.
Save the file
Save the file with a .py extension. For example, you could name it hello.py.
Run the Program:
Open a command prompt or terminal, navigate to the directory where you saved your hello.py file, and type:
python hello.py
Press Enter, and you should see the output:
Hello, World!
Congratulations! You’ve just written and executed your first Python program. The “Hello, World!” program is a simple way to verify that your Python installation is working correctly and to get started with writing and running Python code.
Here’s a link to some books that you can read to gain more knowledge. Happy Learning!!