The simplest way to produce output is using the
print() function where you can pass zero or more expressions separated by commas. This function converts the expressions you pass into a string before writing to the screen.
Syntax: print(value(s), sep= ‘ ‘, end = ‘\n’, file=file, flush=flush)
value(s) : Any value, and as many as you like. Will be converted to string before printed
sep=’separator’ : (Optional) Specify how to separate the objects, if there is more than one.Default :’ ‘
end=’end’: (Optional) Specify what to print at the end.Default : ‘\n’
file : (Optional) An object with a write method. Default :sys.stdout
flush : (Optional) A Boolean, specifying if the output is flushed (True) or buffered (False). Default: False
Returns: It returns output to the screen.
Code #1: Using
print() function in Python(2.x)
GeeksForGeeks Geeks For Geeks Portal [1, 2, 3, 4, 5]
Code #2 : Using
print() function in Python(3.x)
GeeksForGeeks x = 5 GFG Python@GeeksforGeeks
- Print powers using Anonymous Function in Python
- Program to print its own name as output
- Output of Python Program | Set 1
- Output of Python program | Set 5
- Python | Output Formatting
- Output of Python Program | Set 3
- Output of Python Programs | Set 24 (Dictionary)
- Output of Python programs | Set 9 (Dictionary)
- Python | Testing Output to stdout
- Output of Python Programs | (Dictionary)
- Output of Python Programs | Set 22 (Loops)
- Python | Logging Test Output to a File
- Generate two output strings depending upon occurrence of character in input string in Python
- Python | end parameter in print()
- Print with your own font using Python !!
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.