Hello,
I need help with tasks 4 and 5 of the number pattern generator.
The code works until a number with more than one digit is input, this causes the code to return a space in between the number ( for example, instead of getting 10 I get 1 0)
I would like to get a bit of guidance on how to solve this problem.
Thank you for the help.
Due to the fact that the website becomes unresponsive when I try sharing my problem straight through the freecodecamp website, I am sharing it this way.
Here is my code:
def number_pattern(n):
result = ''
if type(n) != int:
return('Argument must be an integer value.')
elif n < 1:
return('Argument must be an integer greater than 0.')
else:
for x in range(1, n+1):
result += str(x)
result = ' '.join(result)
return(result)
print(number_pattern(10))