Update prime-factors.md
This commit is contained in:
@ -14,15 +14,15 @@ Finds and returns the list of prime factors of a number.
|
|||||||
|
|
||||||
```py
|
```py
|
||||||
def prime_factors(num):
|
def prime_factors(num):
|
||||||
factors = []
|
factors = []
|
||||||
factor = 2
|
factor = 2
|
||||||
while (num >= 2):
|
while (num >= 2):
|
||||||
if (num % factor == 0):
|
if (num % factor == 0):
|
||||||
factors.append(factor)
|
factors.append(factor)
|
||||||
num = num / factor
|
num = num / factor
|
||||||
else:
|
else:
|
||||||
factor += 1
|
factor += 1
|
||||||
return factors
|
return factors
|
||||||
```
|
```
|
||||||
|
|
||||||
```py
|
```py
|
||||||
|
|||||||
Reference in New Issue
Block a user