113k views
4 votes
Write a code segment that displays the values of the integers x, y, and z on a single line, such that each value is right-justified with a field width of 6.

User ArturFH
by
6.1k points

1 Answer

2 votes

Answer:

x = int(input ("enter first number: "))

y = int(input ("enter second number: "))

z = int(input ("enter third number: "))

print('%6d %6d %6d' %(x,y,z))

Step-by-step explanation:

Using python programming language we receive three integers variables (x,y,z) then using string formatting (%6) which specifies that the output should be right justified with a width of 6, the values are printed out.

User Kibet Yegon
by
5.4k points