Answer» Hi! Can someone help me with this example? I KNOW it's quite easy, but I can't find right result. (i'm BEGINNER) I'll be glad.
I need a program which'll write this:
for N=3
* ** *** ** *
for n=2
* ** *
I have found result for the first half: def pyramid(n): result="" for X in range(n): result=result + "*" print(result)
I don't know how to continue, can somebody help?:-)try this:
def pyramid(n): for i in range(n): row = '*'*(i+1) print row row = 0 while i >= 0: row = '*'*(i) print row i -= 1
|