Solution is interesting. Conditions should be careful.
classSolution:defisUgly(self,num:int) ->bool:while num >=2and num%2==0: num = num//2while num >=3and num%3==0: num = num//3while num >=5and num%5==0: num = num//5if num ==1:returnTrueelse:returnFalse