Posts

Showing posts with the label Python3

Python print() function

 What is Python Print Function?      To print any message in console we use print() . Its syntax is print(str). Here the str can be a variable or a normal string with single/double-quotes.  Code:      str = "Hello World 1"      print("Hello World 2 !!")      print(str) Output:     Hello World 2 !!     Hello World 1 Attributes: print()  function has attributes that are as follow-           print(object, end='\n', sep=' ') end='\n' -  Optional. Specify what to print at the end. Default is '\n' (newline) sep=' '  -  Optional. Specify how to separate the objects, if there is more than one. Default is ' '. Print() in Python 2 & Python 3: In Python 2, print was not a function it was a keyword that doesn't require parenthesis '()' & in Python 3 the print keyword change to   the print() function. There are a lot of changes in Python 3 compare...