sexy.py
an anonymous user
·
Python
def print_diamond_line(n, i):
if i <= n:
print(" " * (n - i) + "*" * (2 * i - 1))
print_diamond_line(n, i + 1)
def print_diamond(n, i):
if i <= n:
print_diamond_line(n, i)
print_diamond(n, i + 1)
else:
print_diamond_line(n, 2 * n - i)
if i < 2 * n - 1:
print_diamond(n, i + 1)
n = int(input("Enter the value of n: "))
print_diamond(n, 1)
Output
Embed on website
To embed this program on your website, copy the following code and paste it into your website's HTML:
Comments
This comment belongs to a banned user and is only visible to admins.
This comment belongs to a deleted user and is only visible to admins.