0
o = input("Height: ")

if int(o) > 8 or int(o) <= 0:
    o = input("Height: ",end = "")
i = int(o)

for j in range (i + 1):
    # calculating number of spaces
    n = i -j
    # printing spaces
    print(" " * n,end = "")
    #printing first pyramid hashes
    print("#" * j,end = "")
    # printing space between hashes
    print("  ",end = "")
    # printing second table
    print("#" * j,end = "")
    # printing new line
    print()

enter image description here

0

In the for loop, use j in range(1, i + 1). Using j in rage(i + 1) will start at j = 0 so i spaces are printed and then 0 hash marks are printed. There may also be other problems in your code that I won't point out.

Hope this helps. If it does, please check the tickmark.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .