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, number 3 will return a list of [1,2,3].

We will first create an empty array, then we will loop through that number and push the new number (count + 1) into that empty list.

def monkey_count(n):
    li = []
    for i in range(n):
    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:


Leave a Reply

Your email address will not be published. Required fields are marked *