What’s up, coders! I am back with the most classical of the classics: the Star pyramid. If you guys don’t know what THAT is, then you are NOT a programmer(or, you are just some random person that stumbled across this medium post)! Well , I assume you know what that is. So let’s get started on explaining what that is(Yes, I know you are just pretending to know)!
print("*")for i in range(1,6,1):
print(" " *(5-i)+"*" *i)
That is the code for printing a star triangle. Well, all the “i”s seem confusing, so let’s explain it, shall we?
As you can see, this is the layout/ concept of the few lines of code. The black squares represent the stars. Yes: it is basically a rectangle but shaped by space bars: as you can see in the code, it is spacebar + *s.
So that’s how the classical star pyramid works!