Build a Number Pattern Generator - Build a Number Pattern Generator

Tell us what’s happening:

[quote=“bibosk, post:1, topic:767326”]
Hi, made a new post and hopefully you can see my code better now. It runs as it is supposed to but doesn’t clear point 3,4,5 and 6
Thank you for having a look at it. Really enjoying learning to code here.

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36

Challenge Information:

Build a Number Pattern Generator - Build a Number Pattern Generator

You have a spacing issue that is difficult to see

you can see it better if you use print(f'"{resultat}"')

you have an other spacing issues that can be seen easier here:

you have too many spaces before than

Thank ,I did what you said but it doesn’t clear point 3,4,5

with this you get to see the issue with the spacing, you need to fix it after you see it

what is your updated code?

def number_pattern (n):

result=""

if not isinstance(n, int):

return"Argument must be an integer value."

if n<1:

return"Argument must be an integer greater than 0."

for n in range(1,n+1):

      result+=str(n)+' '

return result

resultat=number_pattern(4)

print(f’“{resultat}”')