Build a Number Pattern Generator - Build a Number Pattern Generator

Tell us what’s happening:

The task passed but I wonder why we were not asked to use the print feature at the end of the function.

A function call in this situation must use the print feature in order to display something at the terminal.

Your code so far

# Number Pattern Generator

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 i in range (1, n+1):
        result = result + str (i)
        if i != n:
            result = result + " "
    return result

number_pattern (4)

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Mobile Safari/537.36

Challenge Information:

Build a Number Pattern Generator - Build a Number Pattern Generator

Have you forgotten that you can wrap your function call in print()? Most functions return something.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.