Your First Python Program
It is a long-standing tradition in the programming world that the first program you write in any new language is βHello World.β Itβs a simple test to ensure everything is connected and working as expected.
Writing the Code
Create a new file named hello.py and type the following:
# This is a comment - it doesn't run, it just helps humans read code
print("Hello, World!")
Running the Code
Open your terminal in the same folder where you saved the file and run:
python hello.py
You should see the text Hello, World! printed in your terminal. Congratulations! Youβre officially a Python programmer.
Understanding the print() Function
In Python, print() is a built-in function. It takes whatever is inside the parentheses and displays it on the screen.
Experimentation:
Try printing something else:
print("My name is Radhe")
print(5 + 10)
print("A" * 10)
Notice how Python can handle both text (called strings) and math calculations directly inside the function. In the next section, weβll dive into how to store this data using Variables.