0

I submitted my code for Mario More in Python. Although it works properly by my own checks it gives me a 6/9 when submitted.

from cs50 import get_int

def main():
    n = height()

    for i in range(n):

        #Print left column
        for j in range(n):
            if (i + j < n - 1):
                print(" ", end="")
            else:
                print("#", end="")

        #Print spaces
        for j in range(2):
            print(" ", end="")

        #Print right column
        for j in range(n):
            if (j + n - i <= n):
                print("#", end="")
            else:
                print(" ", end="")

        print()

#Prompt user for positive int between 1 and 8
def height():
    while True:
        n = get_int("Height\n")
        if n >= 1 and n <= 8:
            break
    return n

main()
1

can you also share the output on what checks failed? Sometimes the checks fail on account of extra or misplaced newlines elsewhere, even when the code logic is intact.

Sample of what I mean: Use height = get_int("Height: ") instead of n = get_int("Height\n")

| improve this answer | |
  • There´s not check command so I can´t see where it fails. I´ll try to change that and see what happens. Thank you. – Maria Macarena Garcia Michel Sep 4 at 15:41

You must log in to answer this question.

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