I've tried to get better re: testing not just for a successful result, but for the behavior I want for any given input. My code looks ok to me, but it's building the pyramid even when height > 23. It does break out of the loop for negative values.
I've tried to get gbd running with python, but I'm struggling with it a bit and this is so simple, I'm not sure what gdb would reveal. I know it's something stupid, but can someone explain where I went wrong? Many thanks. Code is below.
# Recreates Mario's half pyramid by getting height as intbtwn 1 and 23 from user import cs50 # prompt user to give positive integer btwn 1 and 23 while True: print("Height:", end="") height = cs50.get_int() if height >= 0 or height <= 23: break for i in range(height): # print spaces for space in range(height - i): print(" ", end="") space += 1 # print hashes for hashes in range(i + 1): print("#", end="") hashes += 1 # print new line print()