Answer to Question #242286 in Python for Raju

Question #242286

Half Pyramid - 3

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.


1
Expert's answer
2021-09-26T02:42:29-0400
def halfPyramid(row,col):
    for x in range(0, col):
        for y in range(0, x + 1):
            print(row, end=' ')
            row += 1
        print(" ")


print("Sample Input 1")
print(10)
print(5)
print("Sample Ouput 1")
halfPyramid(10,5)


print("\nSample Input 2")
print(1)
print(3)
print("Sample Ouput 2")
halfPyramid(1,3)

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