class Solution:
def isUgly(self, num: int) -> bool:
# step1: edge case - num <= 0
if num <= 0: return False
# step2: strip num with all candidate prime factors until num reach mininum
while num % 2 == 0:
num = num//2
while num % 3 == 0:
num = num//3
while num % 5 == 0:
num = num//5
# true condition: check if num == 1
return num == 1