+ 6
I want to print in the given below pattern
111111111 122222221 123333321 123444321 123454321 123444321 123333321 122222221 111111111 https://code.sololearn.com/cW17iH0Jc89l/?ref=app Why the control does not go to the elif condition and increase its element by 1 in each step in the specified condition???
5 Respostas
+ 4
Okk
+ 3
Please tell me somebody
+ 2
# Code by @techtok7 (instagram)
n = int(input("Enter Number : "))
for i in range(-n+1,n):
for j in range(-n+1,n):
if abs(i) >= abs(j):
print(n-abs(i),end=" ")
else:
print(n-abs(j),end=" ")
print("")
+ 1
Ok
+ 1
n=0
s=2*n-2
By this statements, s=-2
And you are checking in elif j>=n and j<=s is false always because you are also decrementing further s=s-1