The print() function is used for sending the output to the screen.It is used to display the output of any variables like string,list,tuple,set,dictionary,etc.Print() function is a built-in function in python language.
Syntax:-
print(*objects,sep=' ',end='\n',file=sys.stdout,flush=False)
Descriptions:-
1.) objects:-The object can be Integer,Float,string,list,tuple,set,etc.
e.g.
Syntax:-
print(*objects,sep=' ',end='\n',file=sys.stdout,flush=False)
Descriptions:-
1.) objects:-The object can be Integer,Float,string,list,tuple,set,etc.
e.g.
a=234
b='ram'
list=[1,2,3,4,5,6]
tuple=(1,2,3,4,5,6)
dictionary={'a':'apple','b':'bag','c':'cat','d':'dog'}
set={'a','e','i','o','u'}
print("value of a=",a)
print("value of b=",b)
print("value of list=",list)
print("value of tuple=",tuple)
print("value of dictionary=",dictionary)
print("value of set=",set)
print("value of 12*45=",12*45)
output of the above python program:-
value of a= 234
value of b= ram
value of list= [1, 2, 3, 4, 5, 6]
value of tuple= (1, 2, 3, 4, 5, 6)
value of dictionary= {'a': 'apple', 'b': 'bag', 'c': 'cat', 'd': 'dog'}
value of set= {'o', 'e', 'i', 'a', 'u'}
value of 12*45= 540
2.) sep=' ' :-This parameter is used to give space between multiple objects.You an use this parameter other than space also.It will be shown in below programs.
e.g.
a=5
b=6
c=24
d=60
e='ram'
f='sita'
print("value of a,b,c,d=",a,b,c,d)
print("value of a,b,c,d=",a,b,c,d,sep=' ')
print("value of a,b,c,d=",a,b,c,d,sep=',')
print("value of a,b,c,d=",a,b,c,d,sep='\n')
print("value of e,f =",e+' '+f)
output of the above python program:-
value of a,b,c,d= 5 6 24 60
value of a,b,c,d= 5 6 24 60
value of a,b,c,d=,5,6,24,60
value of a,b,c,d=
5
6
24
60
value of e,f = ram sita
3.) end=' \n' :-It means,when we call print () function each time.it will end at a new line.In python by default ,print() function always ends at a new line.You can change it. i will see in the programs.
value of a,b,c,d= 5 6 24 60
value of a,b,c,d= 5 6 24 60
value of a,b,c,d=,5,6,24,60
value of a,b,c,d=
5
6
24
60
value of e,f = ram sita
3.) end=' \n' :-It means,when we call print () function each time.it will end at a new line.In python by default ,print() function always ends at a new line.You can change it. i will see in the programs.