PYTHON
PRINT() FUNCTION IN PYTHON
CLASS: XI
COMPUTER SCIENCE(083) PART-2
More use of print():
Syntax:
print(values or statements, sep=‘ ‘, end=‘n’)
sep:- string or symbol inserted between values, by default , a
space
end:- string appended after the last value, default, a new line
Example:
print(10,20,30)
----Output----
10 20 30
If we are not using separator inside the print() function:
If we want to print the output 10 20 30 with comma(,) sign
use sep, it means separator
Example:
print(10,20,30,sep=“,”)
----Output----
10,20,30
If we want to print the output 10 20 30 with (* or &) sign use
sep, it means separator
Example:
print(10,20,30,sep=“*”)
----Output----
10*20*30
Example:
print(10,20,30,sep=“&”)
----Output----
10&20&30
If we want to print the output 10 20 30 with space using t
Example:
print(10,20,30,sep=“t”)
----Output----
10 20 30
If we write print(10,20,30) in a separate line using n. How
you print.
print(10,20,30,sep=“n”) ----Output----10
20
30
Example : To display the as shown below using single print():
print('Example','That','How','To','Use','Separator','In','python',sep='n
')
Example
That
How
To
Use
Separator
In
python
If we want to print the output like this given below:
APPLE,GRAPES,MANGO !!!!!!!!
Hint : we have to use sep for comma(,) and (!) inside end
print(‘APPLE’,’GRAPES’,’MANGO’, sep=“,”,end=‘!!WOWn’)
----Output----
APPLE,GRAPES,MANGO !!WOW

USE OF PRINT IN PYTHON PART 2

  • 1.
    PYTHON PRINT() FUNCTION INPYTHON CLASS: XI COMPUTER SCIENCE(083) PART-2
  • 2.
    More use ofprint(): Syntax: print(values or statements, sep=‘ ‘, end=‘n’) sep:- string or symbol inserted between values, by default , a space end:- string appended after the last value, default, a new line Example: print(10,20,30) ----Output---- 10 20 30 If we are not using separator inside the print() function:
  • 3.
    If we wantto print the output 10 20 30 with comma(,) sign use sep, it means separator Example: print(10,20,30,sep=“,”) ----Output---- 10,20,30 If we want to print the output 10 20 30 with (* or &) sign use sep, it means separator Example: print(10,20,30,sep=“*”) ----Output---- 10*20*30 Example: print(10,20,30,sep=“&”) ----Output---- 10&20&30
  • 4.
    If we wantto print the output 10 20 30 with space using t Example: print(10,20,30,sep=“t”) ----Output---- 10 20 30 If we write print(10,20,30) in a separate line using n. How you print. print(10,20,30,sep=“n”) ----Output----10 20 30
  • 5.
    Example : Todisplay the as shown below using single print(): print('Example','That','How','To','Use','Separator','In','python',sep='n ') Example That How To Use Separator In python
  • 6.
    If we wantto print the output like this given below: APPLE,GRAPES,MANGO !!!!!!!! Hint : we have to use sep for comma(,) and (!) inside end print(‘APPLE’,’GRAPES’,’MANGO’, sep=“,”,end=‘!!WOWn’) ----Output---- APPLE,GRAPES,MANGO !!WOW