It is a task to create a triangular program using overlapping for repetitive statements, and the output form is
12345
2345
345
45
5
I have to do this, but I can't figure it out. How should I don't know what to do I don't know how to program the number and the form that comes out like that (blank in front) because there are a lot of things that are expressed as *.
python
for l in '''12345
2345
345
45
5'''.split("\n"):
print(l)
s = list("12345")
for i in range(5):
print(''.join(s))
s[i] = ' '
for i in range(1,6):
s = ''.join(str(j) for j in range(i, 6))
print(f"{s:>5}")
© 2024 OneMinuteCode. All rights reserved.