In this example, a root number and the number which indicates how many numbers of times that root number should get multiplied have been passed into a function which will then return a list of multiplied numbers of that original number. For example, if we pass in 3 and 5 to this method multiples(3, 5), we will receive a list of multiplied numbers: [5, 10, 15].

def multiples(m, n):
    arr = []
    for number in range(1, m+1):
        arr.append(n * number)
    return arr

As you can see, the m parameter has been used in the range method to create the multiplied numbers list.

Your Homework :

Create a method which will only return the multiplied numbers that are not larger than the power of m for the given n number. Provide your answer in the tweet below.

If you are serious about learning Python, then homework is the best method to improve your Python skill!

Click to rate this post!
[Total: 0 Average: 0]
Please follow and like us:
error0

Leave a Reply

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