Most of the beginners in python always confuse with print function and start searching for print function in google.Like other programming language python print out put function also easy. In this tutorial we are going to explore python print ,the way to print the out put in python. print() is the function used in python to print out put.
Let see example
python print syntax
print(object(s), separator=separator, end=end, file=file, flush=flush)
object = any object, it will convert in to string and print
sep=’separator’ = Optional default ‘ ‘
end=’end’ = Default is line feed, will tell what print at the end
file = Default is sys.stdout , object with a write method.
1) python print a string “Hello World”
print("Hello World") Output: Hello World
2) python print a variable numberstart =10
numberstart =10 print(numberstart) Output: 10
3) python print : managing tuble
tupleA = (2, 4, 8, 12) tupleB = ('red', 'blue') print(tupleA + tupleB ) Output: (2, 4, 8, 12, 'red', 'blue')