finding multiples of a number in Python

后端 未结 7 1034
甜味超标
甜味超标 2021-02-07 10:48

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         


        
7条回答
  •  深忆病人
    2021-02-07 11:12

    If this is what you are looking for -

    To find all the multiples between a given number and a limit

    def find_multiples(integer, limit):
        return list(range(integer,limit+1, integer))
    

    This should return -

    Test.assert_equals(find_multiples(5, 25), [5, 10, 15, 20, 25])
    

提交回复
热议问题