Build a Number Pattern Generator - Build a Number Pattern Generator

Tell us what’s happening:

i am having problem with the running the test for authentication of the integer. The tests for checking if it is an integer and if it is less than 1 keeps returning as false. What could be the reason for it not running?

Your code so far

def number_pattern(n):
    pattern = ""
    
    for i in range(1, n + 1):
        pattern += str(i)
        if i != n:
            pattern += " "
    return pattern

    if not isinstance(n, int):
        return "Arguments must be an integer."
    if n < 1:
        return "Argument must be an integer greater than 0."
    

print(number_pattern(4))


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36

Challenge Information:

Build a Number Pattern Generator - Build a Number Pattern Generator

because the function stops at return, and anything later is ignored
try calling the function with something that is not an integer and see what happens

Thank you very much, I really appreciate it.