0

Can someone please point out what's wrong with my code?

from cs50 import get_int

def main():
    print("Height should be a positive integer between 0 and 23.")

    # a "do-while" loop to recieve a height between 0 & 23
    while True:
        height = get_int("Insert Height: ")
        if height >= 0 and height <= 23:
            break

    spaces = height

    for i in range(height):
        # print spaces
        print(" " * (spaces - 1), end="")
        spaces -= 1

        # print hashes
        hashes = height - spaces
        print("#" * hashes, end="")

        print("  ", end="")

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

        # print a new line
        print()


if __name__ == "__main__":
    main()
2
  • Try deleting print("Height should be a positive integer between 0 and 23.") . Can only speculate that it interferes with check50 capture/parse of stdout. Aug 31, 2018 at 2:37
  • It worked! Thank you so much!
    – Ashley Moe
    Aug 31, 2018 at 13:07

0

You must log in to answer this question.

Browse other questions tagged .