Skip to content

Instantly share code, notes, and snippets.

@RouNNdeL
Last active October 31, 2018 21:58
Show Gist options
  • Save RouNNdeL/83d42f7558c779357809837fb20d12fa to your computer and use it in GitHub Desktop.
Save RouNNdeL/83d42f7558c779357809837fb20d12fa to your computer and use it in GitHub Desktop.
Diamond in Python
def diamond(n):
half = n/2
print(half * " " + "*")
r = range(1, half + n % 2)+range(half-1, 0, -1)
for i in r:
print((half - i) * " " + "*" + (2*i-1) * " " + "*")
print(half * " " + "*")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment