You can create your own range
or not_range
:P
not_range
returns a list
from a
to b
Not using inbuilt range
anywhere!
def not_range(a,b):
if a<b:
return [a]+not_range(a+1,b)
elif a>b:
return [a]+not_range(a-1,b)
else:
return []
rows = 4
for i in not_range(0,rows+1):
s=0
for k in not_range(0,rows-i):
print(end=" ")
for j in not_range(0,i+1):
s=s+10**(i-j)
print(s*s)
print(" ")
for i in not_range(rows-1,-1):
s=0
for k in not_range(0,rows-i):
print(end=" ")
for j in not_range(0,i+1):
s=s+10**(i-j)
print(s*s)
print(" ")
1
121
12321
1234321
123454321
1234321
12321
121
1
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…