Print This pattern using python only | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Print This pattern using python only

This pattern 1 321 54321 7654321 987654321

14th Apr 2020, 2:34 PM
Himanshu Upadhyay
Himanshu Upadhyay - avatar
4 Answers
+ 1
n=int(input("enter no of rows ")) for i in range(n): # for no of rows print(" "*(n-i-1),end="") for j in range(2*i+1): #for no of elements in a column print(str(j-(2*i+1)),end="") print()
14th Apr 2020, 2:47 PM
Himanshu Upadhyay
Himanshu Upadhyay - avatar
0
Actually i had attempted on my pc
14th Apr 2020, 2:39 PM
Himanshu Upadhyay
Himanshu Upadhyay - avatar
0
So if u run the code... It is almost done. Simply the numbers are negative. This little step u can do too.
14th Apr 2020, 2:53 PM
Oma Falk
Oma Falk - avatar
0
Yes the numbers comes negative... i wanna correct this please help me
14th Apr 2020, 3:01 PM
Himanshu Upadhyay
Himanshu Upadhyay - avatar