Created
April 12, 2015 03:18
-
-
Save tebriel/a5af3361f1d302f43ac8 to your computer and use it in GitHub Desktop.
Code Golf Diamond
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
#!/usr/bin/env python3 | |
output = ["%s%s" % (" "*(9-i), "".join(str(num) for num in list(range(1, i+1)) + list(range(1, i+1))[-2::-1])) for i in range(1, 10)] | |
print("\n".join(output + output[-2::-1])) |
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
cmoultrie@Sauron ~/Desktop> ./diamond.py | |
1 | |
121 | |
12321 | |
1234321 | |
123454321 | |
12345654321 | |
1234567654321 | |
123456787654321 | |
12345678987654321 | |
123456787654321 | |
1234567654321 | |
12345654321 | |
123454321 | |
1234321 | |
12321 | |
121 | |
1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment