Skip to content

Latest commit

 

History

History
10 lines (7 loc) · 408 Bytes

end-parameter-in-print.md

File metadata and controls

10 lines (7 loc) · 408 Bytes

End parameter in print()

By default python’s print() function ends with a newline. Python’s print() function comes with a parameter called ‘end’. By default, the value of this parameter is ‘\n’, i.e. the new line character. You can end a print statement with any character/string using this parameter.

n = 5

for i in range(n):
    print(i + 1, end="") # would return 12345