Sunday, 18 September 2022

Python Example Program: Star Pyramid

 Writing Star Pyramid Program using Function in Python

Example:

x="*"
def function(y):
    i=1
    for i in range(y+1):
        z=i*x
        print(f"{z} ")
function(5)  

Output

* ** *** **** *****

No comments:

Post a Comment