Build a Number Pattern Generator - Build a Number Pattern Generator

Tell us what’s happening:

It does exactly what is asked, but my code gets rejected :frowning:

Your code so far

def number_pattern(n):
    if not isinstance(n, int):
        return "Argument must be an integer value."
    if n < 1:
        return "Argument must be an integer greater than 0."
    output = ""
    for i in range(n):
        output += str(i + 1)
        output += " "
    return output

print(number_pattern(4))
print(number_pattern(12))

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0

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

what happens with the last number?

Same thing again, drat.

Thank you by the way

output += " "

put this in a condition states like this

if it doesnt reach the end (n), then add space

In the given instruction, it says the result will be “1 2 3 4” not this “1 2 3 4 “