Python Tutorial

Python Variable

Python Operators

Python Sequence

Python String

Python Flow Control

Python Functions

Python Class and Object

Python Class Members (properties and methods)

Python Exception Handling

Python Modules

Python File Operations (I/O)

The First Python Program - Outputting Text To The Screen

The first Python program is usually a simple program that outputs a message to the screen. Here's an example:

print("Hello, World!")

Explanation:

  • print() is a built-in function in Python that displays a message on the screen.
  • "Hello, World!" is a string literal, which is a sequence of characters enclosed in double quotes. This particular string is a common message used in introductory programming tutorials to demonstrate the basic syntax of a programming language.

To run this program, you can save it as a file with a .py extension, such as hello.py, and then run it using the Python interpreter in a terminal or command prompt. Here's an example:

$ python hello.py
Hello, World!

This program simply outputs the message "Hello, World!" to the screen. It is a simple example that demonstrates the basic syntax of a Python program and how to output text to the screen using the print() function. As you learn more about Python, you can write more complex programs that perform calculations, interact with users, and manipulate data.