2

First of all, chill out man! Programming should be fun, not stressful! It's like solving a mystery, not having exams! :D Anyway your mistake is quite silly (I think it's due to the lack of sleep :P). Take a look at the following lines and find the differences, I think you can solve the rest on your own. ;) line 19: print("#", end="") lines 21 and 24: ...


1

Don't make things complicated. for x in range (height): print((height-x - 1)*' ' + (x+1)*'#')


1

Your first line printed has i being 0, so you print spaces only. Change to range(1, n + 1) to avoid that. BTW, you should not print spaces at the end of the line. As much as I like the symmetry, the checker doesn't.


1

0 and 23 are valid input values. By using >0 and <23 you exclude them. Use >= and <=.


1

The problem was in logic: The loop wasn't actually breaking when I put in a correct value (between 0 and 23) hence the infinite loop, as the logic said for it to break only if it was less or greater. Changing the if statement to the following has fixed the issue: if height > 0 and height < 23: break If that rule isn't followed, the user will ...


1

You could use while and somewhat emulate for, or do an if with a break inside your loop (which I would prefer).


1

First: DO NOT POST CODE AS IMAGES. Post as text, there's a {} button in the editor you can click after selecting the code, which will add four spaces in the front, which tell markdown to format as code. Surely is not nearly as beautiful (no line numbers for example), but one could copy that code snippet to own code and try it out. Or use a service like ...


1

Python is very nit–picking about how you indent your code. In your case, the break should have 8 more spaces before it. return n should have 4 more. Like bellow: import cs50 def main(): height = get_int() def get_int(): while True: n = input("Type a number between 0 and 23: ", end="") if n < 0 or n > 23: break ...


Only top voted, non community-wiki answers of a minimum length are eligible