Created
February 8, 2015 17:39
-
-
Save Boot-Error/137616125bb9fc9e47c7 to your computer and use it in GitHub Desktop.
This generates a pyramid of numbers.. using python.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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