davegimo

verificamultiplo

Aug 24th, 2023
986
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. def verificaMultiplo(a,x,k):
  2.     if isNull(a):
  3.         return False
  4.    
  5.     return auxmultiplo(a,x,k,0)
  6.  
  7.  
  8.  
  9. def auxmultiplo(a,x,k,liv_corrente):
  10.     if isNull(a):
  11.         return True
  12.  
  13.     if liv_corrente > k:
  14.         return info(a) % x == 0 and auxmultiplo(left(a),x,k,liv_corrente + 1) and auxmultiplo(right(a),x,k,liv_corrente + 1)
  15.     else:
  16.         return auxmultiplo(left(a),x,k,liv_corrente + 1) and auxmultiplo(right(a),x,k,liv_corrente + 1)
Advertisement
Add Comment
Please, Sign In to add comment