Generate Multiples
Beginner
Let's help you master the art of loops and multipliers! Your task is to create a function that takes two integers: n and m, and returns a list containing the first m multiples of n. This exercise will help you get familiar with using loops and list manipulations in Python.
Here's how it works:
- If
nis 3 andmis 5, then the first 5 multiples of 3 are: 3, 6, 9, 12, and 15. - If
nis 2 andmis 4, then the first 4 multiples of 2 are: 2, 4, 6, and 8.
Examples:
multiples_of_number(3, 5) # Output: [3, 6, 9, 12, 15] multiples_of_number(2, 4) # Output: [2, 4, 6, 8]
Have fun generating numbers and exploring what the world of Python holds for you!
Inputs
Arg 1:
3Arg 2:
5Expected Output
[3, 6, 9, 12, 15]Actual Output