I\'m trying to write a code that lets me find the first few multiples of a number. This is one of my attempts:
def printMultiples(n, m):
for m in (n,m):
prin
If you're trying to find the first count
multiples of m
, something like this would work:
def multiples(m, count):
for i in range(count):
print(i*m)
Alternatively, you could do this with range:
def multiples(m, count):
for i in range(0,count*m,m):
print(i)
Note that both of these start the multiples at 0
- if you wanted to instead start at m
, you'd need to offset it by that much:
range(m,(count+1)*m,m)