python multiply digits of a number

Solutions on MaxInterview for python multiply digits of a number by the best coders in the world

showing results for - "python multiply digits of a number"
Renata
18 Aug 2019
1def getProduct(n):
2 
3    product = 1
4 
5    # Converting integer to string
6    num = str(n)
7     
8    # Traversing the string
9    for i in num:
10        product = product * int(i)
11 
12    return product