HOW TO PRINT IN PYTHON?

315 viewsPYTHONPython
0

HOW TO PRINT IN PYTHON?

Saraswat World Changed status to publish June 14, 2023
0
Print in Python
Print in Python

•print function,which writes to standard out. Standard out is where the computer writes its output.

•Strings or characters are enclosed in inverted commas.

print(“hello world”)

•Output of above statement.

hello world

•To print out multiple items, you can provide them separated by commas. You can put strings and numbers in a print function.

print(“my”,”program no.”,1)

Output of the above statement, Python inserted a space between them.

my program no. 1

Below statement will output the value you assigned to your variables(variable1 and A)

variable1=10

A=5

print(variable1, A)

Output of the above statement

10 5

To output multiple string variables we can use + operator:

B=”Hello”

C=”World”

print(B+C)

Output of the above statement

HelloWorld

In case of integer or float variables + operator will give sum of values stored in variables, as shown below:

B=5

C=10

print(B+C)

Output of the above statement

15

Saraswat World Changed status to publish June 14, 2023
Write your answer.

Posted

in

Tags:

Comments

Leave a Reply

Ganesh Ji Arti A Tribute to Dilip Kumar