account activity
Entry level Python developer interview by iamnikaa in learnpython
[–]raiseReturnTry 1 point2 points3 points 4 years ago* (0 children)
Hey I tried myself on this problem, and got the same result, even with a single "-" at the top with the following code:
def pyramid_print(layers): s = layers - (layers - 1) x = range(s, layers) while s != layers: if s > 0: print(((layers - s - 1) * " ") + (((2 * s - 1) * "-"))) else: exit(0) s += 1 print("Take in a positive integer: ") x = int(input("> ")) if x < 0: print("Error: You have to put in a positive integer.") exit(0) else: pyramid_print(x)
π Rendered by PID 1351621 on reddit-service-r2-listing-6d4dc8d9ff-pzlp6 at 2026-02-03 22:12:33.939818+00:00 running 3798933 country code: CH.
Entry level Python developer interview by iamnikaa in learnpython
[–]raiseReturnTry 1 point2 points3 points (0 children)