DEV Community

Discussion on: Learning Algorithms with JS, Python and Java 9: Printing Steps

Collapse
 
vdedodev profile image
Vincent Dedo • Edited

Or better python

def steps(n):
for x in range(1, n+1):
print "{}{}".format('#' * x, ' ' * (n-x))

Edit: how do you format code on here?

Collapse
 
tommy3 profile image
tommy-3 • Edited

Ah, this is nice indeed. Thanks for your comment!

how do you format code on here?

I'm using different editors/IDEs for each language and I let them format the code.
I'm using VS Code for JS, PyCharm for Python and Eclipse for Java. I don't really have a strong reason for it.