Guest User

Untitled

a guest
Jul 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. # Unoptimized, and actually wrong code
  2. # Written to solve problems in my textbook, and does that well
  3. # Don't use, don't judge.
  4.  
  5. def solve(functions):
  6. def solve_recurse(functions, values, count):
  7. old_values = values[:]
  8. for i in range(len(functions)):
  9. values[i] = f(*values)
  10. print values
  11. if values == old_values:
  12. print "Solved in %s iterations!" % count
  13. else:
  14. solve_recurse(functions, values, count+1)
  15. solve_recurse(functions, [0 for f in functions], 1)
Add Comment
Please, Sign In to add comment