Right Arrow Pattern
Input Format:
Take an input Integer which is from stdin.
Output Format:
print Right Arrow pattern
Example Input:
5
Output:
***** **** *** ** * ** *** **** *****
n=int(input())
for i in range(n):
for j in range(2*i): #for spaces as each i th row has 2*i spaces
print(" ",end="")
for k in range(n-i): #for stars as each i th row has n-i stars
print("*",end="")
print("") # half pattern is completed here
for i in range(2,n+1): #range started from 2 as the single star at middle is already printed in above loops
for j in range(2*(n-i)): #for spaces as each i th row has 2*(n-i) spaces as the second half starts
print(" ",end="")
for k in range(i): #for stars as each i th row has i stars
print("*",end="")
print("")
Comments
Post a Comment