0

The program runs fine just that I keep getting an extra line after the user inputs so check50 rejects it because of the \n before # #

def main():
    hashHeight = height()
    create(hashHeight)
    
# get height
def height():
    h = int(input("Height: "))
    if h >= 1 and h <= 8:
        return h
    else:
        height()

#print hash
def create(x):
    for i in range(x + 1):
        print(" " * (x - i) + "#" * i + "  " + "#" * i)

main()

1 Answer 1

1
  • The i loop will print height + 1 lines.
  • i starts at 0, so this "#" * i prints how many # on the first iteration?
1
  • Got it!!! Thank you! I did not realize I could have a range from (1, x+1) Commented Jul 15, 2020 at 5:43

You must log in to answer this question.

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