Advertisement
dmesticg

Untitled

May 22nd, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. def waterjugz(big,small):
  2. bmax = 4
  3. smax = 3
  4. goal = 2
  5. if bmax%smax == 0:
  6. return("No Solution")
  7. elif big == goal:
  8. return("Solution Found")
  9. elif big < bmax and small != 0:
  10. return(waterjugz(big + small,0))
  11. elif small == 0:
  12. return(waterjugz(big,small+smax))
  13. else:
  14. return(waterjugz(0,big-bmax))
  15.  
  16. print(waterjugz(0,0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement