>>56409774Your smug animu grils are no match for the power of both an iterative and recursive solution in Python:
#!/usr/bin/python3
def numStars(step) :
return (step * 2) - 1
def numSpaces(step, maxStep) :
return int((numStars(maxStep) - numStars(step)) / 2)
def printStars(step, maxStep) :
print(' ' * numSpaces(step, maxStep), end="")
print('*' * numStars(step))
pyramidDepth = int(input("How deep is your pyramid love? "))
def recursivePyramid(currentStep, maxStep) :
printStars(currentStep, maxStep)
if currentStep < maxStep:
recursivePyramid(currentStep+1, maxStep)
recursivePyramid(1, pyramidDepth)
# Of course, we could just iterate.
for step in range(1, pyramidDepth+1) :
printStars(step, pyramidDepth)