-5
I’m solving the following exercise:
Make a program that prints on the screen the numbers from 1 to 20, one below the other. Then modify the program to show the numbers next to each other.
The first part of the statement I managed to solve, using the loop while
as follows:
x = 1
while x<=20:
print(x)
x +=1
But I’m having a hard time keeping them in line, and I have no idea how to fix this.
Have you tried concatenating the numbers and then displaying this concatenated value? If you don’t know how to do this, search for concatenation that you must find something that will elucidate a solution for you
– Rafael Tavares
As already mentioned above, just make a concatenation of
strings
, For example, suppose I saya = 'b' + 'c'
and then doprint(a)
, he will print on the screen:'bc'
– yoyo