Skip to content

Instantly share code, notes, and snippets.

@Dioarya
Created July 27, 2022 15:38
Show Gist options
  • Save Dioarya/c458049e63e1c77c831bc4b37caadd49 to your computer and use it in GitHub Desktop.
Save Dioarya/c458049e63e1c77c831bc4b37caadd49 to your computer and use it in GitHub Desktop.
def heart(n):
s = ""
for i in range(n):
s0 = " " * (n - i - 1)
s1 = "*" * (i * 2 + 1)
s2 = " " * (2 * (n - i) - 1)
s3 = "*" * (i * 2 + 1)
s4 = " " * (n - i - 1)
s += s0 + s1 + s2 + s3 + s4 + "\n"
for i in range(1, n * 2):
s0 = " " * i
s1 = "*" * (2 * (2 * n - i) - 1)
s2 = " " * i
s += s0 + s1 + s2 + "\n"
return s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment