Did a little refactoring and logic adjustment. A little less *seat of the pants* in this one…

```
def is_prime(x):
if x < 2: return False
if x > 2:
u = int(x ** 0.5) + 1
n = 2
while n < u:
if x % n:
n += 1 if n == 2 else 2
continue
return False
return True
def prime_factors(x):
if is_prime(x): return "{} is Prime".format(x)
factors = []
u = int(x ** 0.5) + 1
n = 2
while n < u:
y = x
if is_prime(n):
while y % n == 0:
factors.append(n)
y //= n
if y != x and is_prime(y): factors.append(y)
n += 1 if n == 2 else 2
return factors
def semiPrimeDetector(x):
return len(prime_factors(x)) == 2
```

```
print (3, prime_factors(3))
print (3, semiPrimeDetector(3))
print (69, prime_factors(69))
print (69, semiPrimeDetector(69))
print (89, prime_factors(89))
print (89, semiPrimeDetector(89))
```

```
Python 3.6.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
>
3 3 is Prime
3 False
69 [3, 23]
69 True
89 89 is Prime
89 False
>
```

Of course it is not ideal but it gives us a chance to view the ideal through this lens. What of it is *fuzzy logic* and where might there be need of *recursion*? Making this general construct more efficient is the next goal, but I suspect we will see improvements upon the themes in upcoming submissions.