I want to print in the given below pattern | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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???

24th Mar 2020, 5:12 AM
SOUMYA
SOUMYA - avatar
5 Answers
+ 4
Okk
24th Mar 2020, 3:30 PM
SOUMYA
SOUMYA - avatar
+ 3
Please tell me somebody
24th Mar 2020, 6:41 AM
SOUMYA
SOUMYA - avatar
+ 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("")
24th Mar 2020, 3:52 PM
Techtok7
Techtok7 - avatar
+ 1
Ok
24th Mar 2020, 7:20 AM
Mohammed Qadir khan
Mohammed Qadir khan - avatar
+ 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
24th Mar 2020, 9:17 AM
Jayakrishna 🇮🇳