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:
3. 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
4. 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
5. 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
6. 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