# Program - Given a decimal number N, write python functions check and print if a number has consecutive zeroes or not after converting the number to its K-based notation.

## Topic: Program - Given a decimal number N, write python functions check and print if a number has consecutive zeroes or not after converting the number to its K-based notation.

Solution

def hasConsecutiveZeroes(N, K): z = toK(N, K) if (check(z)): print("Yes") else: print("No") def toK(N, K): w = 1 s = 0 while (N != 0): r = N % K N = N//K s = r * w + s w *= 10 return s def check(N): fl = False while (N != 0): r = N % 10 N = N//10 if (fl == True and r == 0): return False if (r > 0): fl = False continue fl = True return True

List all Python Programs