| print(*objects, sep=' ', end='\n', file=None, flush=False) |
Print objects to a text stream (built-in). |
| objects | ?? |
| sep | ?? |
| end | ?? |
| file | ?? |
| flush | ?? |
| REMARKS |
| * This is a built-in function. * Print objects to the text stream file, separated by sep and followed by end. sep, end, file, and flush, if present, must be given as keyword arguments. * All non-keyword arguments are converted to strings like str() does and written to the stream, separated by sep and followed by end. Both sep and end must be strings; they can also be None, which means to use the default values. If no objects are given, print() will just write end. * The file argument must be an object with a write(string) method; if it is not present or None, sys.stdout will be used. Since printed arguments are converted to text strings, print() cannot be used with binary mode file objects. For these, use file.write(...) instead. * Output buffering is usually determined by file. However, if flush is true, the stream is forcibly flushed. * Even though there is no print statement, the terminal always displays results from executing expressions. * For the Official documentation refer to python.org |
print("1" + "2") #= "12"
print(1 + 2) #= 3
print(1 - 2) #= -1
print(1 * 2) #= 2
print(5 - 8) #= -3
print(10 - 3.4) #= 6.6
print(2 ** 4) #= 16
print(10 ** .5) #= 3.162277
print(4 // 3) #= 1
print(5 // 3) #= 1
print(2.5 // .5) #= 5.0
print(6 % 2.1) #= 1.799999
print(16 % 12) #= 4
print(4 % 2) #= 0 Even numbers produce 0
print(5 % 2) #= 1 Odd numbers produce 1
print(1 + 1.0) #= 2.0
print(5.0 == 5) #= True
print(5.0 != 5) #= False
print("This will\nbe on two lines.") # includes newline
print("\tThis will\thave some\tgaps.") # includes tabs
print(' hello world ')
print(' hello, "' + var + '"')
# space is added automatically
print(4.5, 'hello') #= '4.5 hello'
print('hello', end:=/n)
print('hello' * 3)
print('a' > 'Z')
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited Top