0

I tried two different variations but both reach 96% completeness

code 1:

from cs50 import get_int

while True:
    height = get_int("Height: ")

    if height < 9 and height > 0:
        break

for rows in range(height):
    num_hashes = rows + 1
    num_spaces = height - rows - 1

    print(" " * num_spaces, end = "")

    print("#" * num_hashes, end = "")

    print("  ", end = "")

    print("#" * num_hashes, end = "")

    print()

code 2:

from cs50 import get_int

while True:
    height = get_int("Height: ")

    if height < 9 and height > 0:
        break

for rows in range(height):
    for space in range(height - rows - 1):
        print(" ", end = "")

    for block in range(rows + 1):
        print("#", end = "")

    print("  ", end = "")

    for block in range(rows + 1):
        print("#", end = "")

    print()

1 Answer 1

0

You're losing points for style. ;-)

Try running your source code file through style50

0

You must log in to answer this question.

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