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
|
||||
def prime_factors(num):
|
||||
factors = []
|
||||
factor = 2
|
||||
while (num >= 2):
|
||||
if (num % factor == 0):
|
||||
factors.append(factor)
|
||||
num = num / factor
|
||||
else:
|
||||
factor += 1
|
||||
return factors
|
||||
factors = []
|
||||
factor = 2
|
||||
while (num >= 2):
|
||||
if (num % factor == 0):
|
||||
factors.append(factor)
|
||||
num = num / factor
|
||||
else:
|
||||
factor += 1
|
||||
return factors
|
||||
```
|
||||
|
||||
```py
|
||||
|
||||
Reference in New Issue
Block a user