Build a Number Pattern Generator - Build a Number Pattern Generator

Tell us what’s happening:

My code does not qualify for 3 to 7, but it does everything that is required for those steps.
When inputting 4 → 1 2 3 4
0 → Argument must be an integer greater than 0.
“three” → Argument must be an integer value.
12 → 1 2 3 4 5 6 7 8 9 10 11 12

Your code so far

def number_pattern(n):
    if not isinstance(n, int):
        message = print("Argument must be an integer value.")
        return message
    elif not n > 0:
        message = print("Argument must be an integer greater than 0.")
        return message
    else:
        number_list = print(*range(1, n + 1))
        return number_list


number_pattern(0)

Your browser information:

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

Challenge Information:

Build a Number Pattern Generator - Build a Number Pattern Generator

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-number-pattern-generator/6842a6cd9836f0114a5b7a8a.md at main · freeCodeCamp/freeCodeCamp · GitHub

Welcome to the forum @fi3fd0m

3. number_pattern(4) should return 1 2 3 4.

image

Notice the difference between the first function call, and the second print call?

Also, None is appearing in the console.

Your function needs do a specific action with the number range.

Happy coding

Hello and thank you along with thank you for the quick reply!

As for difference, it’s that one of them is a print call while the other is a calling on the function?

no, they are both calling the function, but one is just the function call, while the other has the function call inside a print, which means it is printing the function output

you need to check the function output, most of the time that is what the tests are testing