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.
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)
Comments
Leave a comment