Home 03. Print Function in Python
Post
Cancel

03. Print Function in Python

Syntax

1
2
3
4
print("Hello World")     # parameter accepts as string

# Error: invalid syntax
# print(Hello World)

Every “print” statement start from new line:

1
2
3
# print ends with a new line 
print("Hi")
print("I'm Irfan")

For writing statement in one line:

1
2
3
4
5
6
# print ends with blank space
print("How are you?",end ="")      # Blank for no space
print("I am fine", end=',')     # Ending with ,
print("and you?", end='joker')     # you can write anything
print("???", end=' ')     # or even space
print("I also good")

Two string in print() separated with comma(,) shows as one space separated statement:

1
2
# , == ' '
print("Subscribe Now","and brother do like also")
This post is licensed under CC BY 4.0 by the author.

02. Comments

04. Escape Sequence