Ad
Fundamentals

The YouTube video that inspired this: https://www.youtube.com/watch?v=vKlVNFOHJ9I

When a number n is inputted, the function produces a number where its digits count up to n and back down to one.

Here are some examples of how the function should function.

1 --> 1
2 --> 121
3 -- > 12321

Notice how there is only one n in the integer.

For situations where n > 9, some numbers may be two digits instead of one, such as the example here:

10 --> 12345678910987654321

All numbers will be integers greater than zero.

def numberprint(x):
    accending = list(range(1, x + 1))
    descending = list(range(x-1, 0, -1))
    newlist = accending + descending
    strings = [str(integer) for integer in newlist]
    a_string = "".join(strings)
    an_integer = int(a_string)
    return an_integer