Answer to Question #227024 in Python for Naveen

Question #227024

Given an integer

N as a starting number and K as input, write a program to print a number pyramid of K rows as shown below.Input

The first line of input is an integer

N. The second line of input is an integer K.Explanation

In the example, the given starting number is

10, and the number of rows in the pyramid is 5.


1
Expert's answer
2021-08-18T11:20:12-0400
n = int(input())
k = int(input())
for r in range(k):
    print(*[n + i for i in range(r + 1)])
    n += r + 1

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS