In Python, this is the first program we are writing where we print something on the screen. So we created our first file here,

file: print.py

print("Hello World!")

output

Hello World!
  • print() → a function used to display output in the console
print("Hello World!")
      └────────────┘

           └── string (text written inside double quotes)
print("Hello World!")
print("With Python")

output

Hello World!
With Python

So, when we write in different lines, it will also print in different lines.

print("Hello World", "With Python")

output

Hello World With Python

When we want to write two things on the same line, we can use a comma between two string.

print("Hello \n World", "With Python")

output

Hello
 World With Python

Also, when we use \n, that means a new line.

<< First Python Program | Python Character Set >>