end

The keyword parameter of print that sets what is printed after the last argument; by default a newline.

In more detail

print(x, end=" ") keeps the next output on the same line, which is how a loop prints several values in one row. Finish the line afterwards with a bare print().

Example

for i in range(3):
    print(i, end=" ")
print()

Related terms

Taught in

References

Certification courses