for i in range(0,7) :
for j in range(0, i):
print(j, end='')
print()
I made the chords like this.
0
01
012
0123
01234
012345
Here's the result.
What should I do to make it look symmetrical to the shape?
0
01
012
0123
01234
012345
As for the first shape, I just printed out the number and wrote it automatically when I changed the line
For the second shape, print as many spaces as you want, and then print out the first shape without rewinding.
I think it's hard to see if it's going well because we're filling in the gaps If you want
012345
01234
0123
012
01
0
You should try that first
Then, simply replace the number you are output with a space and combine it with the code above.
What you're facing right now is an old problem called left padding. Search for it.
There could be many situations.
But the question given doesn't seem to assume such a complicated situation... Let's make it easy.
Interestingly, Python is something like this.
for x in range(0, 7) :
y = 7 - x
print(' ' * y + '?')
© 2024 OneMinuteCode. All rights reserved.