Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input("Enter the value of N : "))
- string = f"{n}" * (n*2-1)
- res = [string]
- # Decreasing Pattern (First Half)
- i = 1
- n -= 1
- while n>0:
- str_temp = f"{n}"*len(string[i:len(string)-i])
- string = string[:i] + str_temp + string[::-1][:i][::-1]
- res.append(string)
- n -= 1
- i += 1
- # Increasing Pattern (Second Half)
- res.extend(res[::-1][1:])
- # Displaying the Pattern
- for i in res:
- print(" ".join(tuple(i)))
Add Comment
Please, Sign In to add comment