PRACTICE CODE SNIPPETS

PRACTICE CODE SNIPPETS

Search This Blog

Monday, August 22, 2022

star pattern

 num=int(input("enter no of rows: "))#5

k=1
for i in range(num):#0,1,2,3,4
    for j in range(0,num-i-1):#0,5-0-1=4
        print(end="  ")
    for j in range(1,k+1):#1,2
        print("*",end=" ")
    k=k+2
   
    print()
       

No comments:

Post a Comment

Practice and let me know for nw code snippets