Skip to content

Instantly share code, notes, and snippets.

@rob-smallshire
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rob-smallshire/8d807baa643c0e7d5d1a to your computer and use it in GitHub Desktop.
Save rob-smallshire/8d807baa643c0e7d5d1a to your computer and use it in GitHub Desktop.
Print a diamond
def d(t):s=ord(t)-65;h=lambda i:'-'*(s-i)+chr(i+65)+'-'*i;m=[h(i)+h(i)[-2::-1] for i in range(s+1)];return'\n'.join(m+m[-2::-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment