Build a Number Pattern Generator - Build a Number Pattern Generator

Tell us what’s happening:

i can get it to make a list or tuple of the numbers but i cant convert it to a string
ive tried a couple different lines of code and they all have the same issue
i also am now having trouble with the must be integer part, i had it in the beginning, but ive changed it and forgot what i put.

Your code so far

def number_pattern(n):
        if n <= 0:
            return "Argument must be an integer greater than 0."
        else: 
            ans = tuple(range(n + 1))
            for obj in ans:
                return 
print(number_pattern(6))




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 @josephg!

  1. If the argument passed to the function is not an integer value, the function should return Argument must be an integer value.

Where are you implementing User Story #4?

Currently, your function is not returning anything. That’s why you see None in the console when you call it.

Debug your code by adding print(obj) inside the loop. Is that what you expect?

I suggest looking up how to start a range at 1 instead of 0 and how to convert a tuple of numbers to a space-delimited string.

Happy coding!

okay, bet! I was honestly questioning whether or not i should try to stick with what i was given in the lessons or reach out on the web. i couldn’t tell if it defeated the purpose of finding it out on my own instead of getting the answer. the Join() method pops up, i saw it in other code, but i was trying to avoid it and go back through the reviews and the other workshops and labs to see if i could find the answer there.