Skip to content

Instantly share code, notes, and snippets.

@rawinng
Created December 6, 2020 12:23
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 rawinng/ffe9e8186ff1ef867157379b267dfc82 to your computer and use it in GitHub Desktop.
Save rawinng/ffe9e8186ff1ef867157379b267dfc82 to your computer and use it in GitHub Desktop.
def main():
n = int(input("Input any number : "))
print_diamond(n)
def print_diamond(n):
s = str(int('1'*n)**2)
print(s)
f = '%'+str(n-1)+'s'
for i in map(int,s):
print(f % s[:i-1]+s[-i:])
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment