Some String Exercises

1. Create the function ChristmasTree(treeChar, edgeChar, height) that prints a Christmas tree.  Examples:

>>> ChristmasTree('x','|',5)
     x
    |x|
   |xxx|
  |xxxxx|
 |xxxxxxx|
    xxx
    xxx

>>> ChristmasTree('x','|',10)
          x
         |x|
        |xxx|
       |xxxxx|
      |xxxxxxx|
     |xxxxxxxxx|
    |xxxxxxxxxxx|
   |xxxxxxxxxxxxx|
  |xxxxxxxxxxxxxxx|
 |xxxxxxxxxxxxxxxxx|
         xxx
         xxx

>>> ChristmasTree('.','-',20)
                    .
                   -.-
                  -...-
                 -.....-
                -.......-
               -.........-
              -...........-
             -.............-
            -...............-
           -.................-
          -...................-
         -.....................-
        -.......................-
       -.........................-
      -...........................-
     -.............................-
    -...............................-
   -.................................-
  -...................................-
 -.....................................-
                   ...
                   ...

2. Create the function perfectNumbers(maximum) which prints out all the perfect numbers between 2 and maximum.  A perfect number is one whose factors (less that itself) add up to the number.  For instance, the smallest perfect number is 6, because 6 = 1+2+3, and the next one is 28 = 1+2+4+7+14.  These are the only two perfect numbers below 100.  BTW, there is a formula (sort of) for even perfect numbers.  But it is not known whether there are any odd perfect numbers.  Try to find all the perfect numbers under 10,000.  Your function should print its answers out in the following form:

>>> perfectNummbers(100)
6 = 1 + 2 + 3
28 = 1 + 2 + 14 + 4 + 7