Given a number, return a list of integer with python function.

In this chapter, we are given a number and we need to return a list of integer based on that number, for example, n

We will first create an empty array, then we will loop through

def monkey_count(n): li = [] for i in range(n): li.append(i+1) return li

There is one easy solution as compared to the above, let me know in the comment box below this post.

Please follow and like us:

The `range(1, n+1)` will accomplish the same.