Skip to content

Instantly share code, notes, and snippets.

@Boot-Error
Created February 8, 2015 17:39
Show Gist options
  • Select an option

  • Save Boot-Error/667d9e789d7ab9d45f9c to your computer and use it in GitHub Desktop.

Select an option

Save Boot-Error/667d9e789d7ab9d45f9c to your computer and use it in GitHub Desktop.
This generates a pyramid of numbers.. using python.
# Maximum Limit
limit = 20
# generates the series as a list
pyramid = [a[0:-1]+a[::-1] for a in ["".join([str(k) for k in range(1, i+1)]) for i in range(1, limit+1)]]
# pretty print
for num in pyramid:
print num.center(len(pyramid[-1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment