Python is a high-level, interpreted programming language known for its simplicity and readability. It allows you to write clear programs on both small and large scales. It was created by Guido van Rossum and first released in 1991.
Python code is designed to be easy to understand and fun to write. It is used by beginners and professionals alike due to its versatility and wide range of applications.
Python is an interpreted language, executed line-by-line. No compilation is needed.
Python files have a .py extension. Run them using:
python my_script.py
The print() function displays output in the console. It is commonly used in beginner programs to show messages and test logic.
Example of a simple program that prints a message:
# This is a comment in Python
print("Hello, World!")
Another example of a simple Python program:
print("Welcome to Python!")
If you run the first program, the output will be:
Hello, World!
If you run the second program, the output will be:
Welcome to Python!
The browser or terminal reads each line of your Python file from top to bottom. Lines that start with # are comments, which Python ignores. The print() lines are executed and their text appears in the output.