PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'''https://www.sololearn.com/Discuss/850718/?ref=app
I was asked to explain how this code works
at https://code.sololearn.com/cLEXgEKDOxUd/?ref=app:
'''
for i in range(14):
print(sum(range(i if i < 8 else 14 - i)) * "{}".format("-" if 5 < i < 9 else "."))
'''The challenge is to print this triangle made of 11 horizontal lines
(actually 13 lines because the first and last have a length of zero):
.
...
......
..........
---------------
---------------------
---------------
..........
......
...
.
According to the reference guide given in the challenge:
0 = 0
0+1 = 1
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run