finding multiples of a number in Python

后端 未结 7 1015
甜味超标
甜味超标 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:21

    For the first ten multiples of 5, say

    >>> [5*n for n in range(1,10+1)]
    [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]
    

提交回复
热议问题