Build a Number Pattern Generator - Build a Number Pattern Generator

Tell us what’s happening:

My code runs fine and I’m getting the desired output, but the code checker is telling me that it doesn’t produce the proper number sequence. Any thoughts?

Your code so far

def number_pattern(n):
    if not isinstance(n, int):
        return 'Argument must be an integer value.'
    elif n < 1:
        return 'Argument must be an integer greater than 0.'
    else:
        result = ''
        for number in range(1, n+1):
            result += str(number) + ' '
        return result

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/147.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 @magicfilichia

You function is adding an extra space at the end of the string.

Happy coding

THANK YOU! Not sure if there was a more proper way to fix it, but I just removed the last character at the end of the function