Skip to main content

Introduction To Python Programming

Python is an open-source (free) programming language known for its simplicity and readability. It is widely used in various domains such as machine learning, data science, web development, scientific research, and more.

Guido van Rossum created Python, and it was first released in 1991.

🤔How the Print Function Works​

The print function in Python is used to display output on the standard output device, which, in most cases, is the screen. The print function accepts a string as an argument. A string is a sequence of characters enclosed in single quotes '' or double quotes "".

Here is an example of using the print function to display Hello World on the screen:

hello world.py
print("Hello World!")

Output

Hello World !!

In the above example, the print function takes the string Hello World! as an input and displays it on the screen.

You can pass any text or variables to the print function, and it will print them on the screen.

Here's an example that demonstrates multiple lines and special characters:

sample.py
print("Hi\nGood Evening\nWelcome To Python Programming!!")

Output

Hii
Good Evening
Welcome To Python Programming!!

In the above example, the \n character is used to create line breaks, resulting in each string appearing on a new line when printed.

Feel free to explore and experiment with the print function to display different outputs in your Python programs.