How to make a pyramid of numbers | Sololearn: Learn to code for FREE!
0

How to make a pyramid of numbers

12th Feb 2020, 7:20 PM
Hamza Ali
Hamza Ali - avatar
7 Respuestas
+ 5
Please show your attempts.
12th Feb 2020, 7:31 PM
AÕĘJ
AÕĘJ - avatar
+ 5
k = int(input("enter the number of rows:")) print() for i in range(0,k): for j in range(0,k): print(end=" ") k = k - 1 for i in range (0,i+1): print(i+1,end=" ") print()
14th Feb 2020, 8:53 AM
RKK
RKK - avatar
+ 3
Hamza Ali Check this I updated some. Now rest is your work. k = int(input("enter the number of rows:")) for i in range(0,k): for j in range(0,k): print(end=" \n") k = k - 1 for i in range (0,i+1): print(i+1,end=" ")
12th Feb 2020, 8:15 PM
AÕĘJ
AÕĘJ - avatar
+ 3
It works for 2 digits number also. But some extra lines are coming after each line so you have to check that.
12th Feb 2020, 8:26 PM
AÕĘJ
AÕĘJ - avatar
12th Feb 2020, 8:04 PM
Hamza Ali
Hamza Ali - avatar
0
Sir i have tried this but this work for only 1 digit number
12th Feb 2020, 8:16 PM
Hamza Ali
Hamza Ali - avatar
0
How it works for 2 digit number what line should be added
12th Feb 2020, 8:27 PM
Hamza Ali
Hamza Ali - avatar