In Python How Do You Print Three Integers Separated by a Space on the Same Line?

Problem scenario
You want to print three integers. You do not want to convert them to be part of a string. You want a space to separate each integer. How do you do this in Python?

Solution
Assuming your variables are x, y, and z, and they are integers, use a line like this:

print(x, y, z)

Here is a complete program that proves it works:

x = 5
y = 3
z = 100
print(x, y, z)
print(type(x))
print(type(y))
print(type(z))

Leave a comment

Your email address will not be published. Required fields are marked *