Skip to content

Rhaptos Software Development

Personal tools
You are here: Home » Development » Tuesday Python Challenge » Challenge #6: Pyramid

Challenge #6: Pyramid

Document Actions
A classic programming contest challenge. Everyone should try this one.
Create a function that, given an integer, can create a triangle of increasing numbers, like so::
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
with the last number being the given integer.

Now, do it right-aligned:
        1
      2 1
    3 2 1
  4 3 2 1
5 4 3 2 1
For extra credit, do it center aligned.
Created by jccooper
Last modified 2006-08-21 19:01

Answers here.

Posted by jccooper at 2006-08-21 19:01
Solutions here, to avoid spoilers.

Re: Answers here.

Posted by cbearden at 2006-08-22 10:08
http://mountainbunker.org/~cbearden/PythonChallenge/challenge06.py.txt

Re: Answers here.

Posted by jenn at 2006-08-22 15:50
I haven't figured out how to make things pretty in these responses, but I did finally figure out how to link to something prettier than plain text! Not all that important for pure-code answers, but I got kinda chatty on this one.

http://rhaptos.org/Members/jenn/pychallenges/pychallenge6