You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
799 B

7 years ago
  1. from uniPerm import perms
  2. from math import log
  3. import random
  4. from sympy.core.sympify import sympify
  5. from sympy.simplify.simplify import simplify
  6. def con_base(n,b):
  7. out = []
  8. if n == 0:
  9. return [0]
  10. for p in range(int(log(n,b)),-1,-1):
  11. out.append(n//(b**p))
  12. n %= b**p
  13. return out
  14. def zp(lst,n):
  15. l = []
  16. for i in range(n-len(lst)):
  17. l.append(0)
  18. return l + lst
  19. def getInput(blah):
  20. sanitized = list(
  21. filter(
  22. lambda x: x,blah.split(' ')
  23. )
  24. )
  25. return list(
  26. map(
  27. lambda x: int(x),sanitized
  28. )
  29. )
  30. def choose(lst,select):
  31. return list(map(lambda x: lst[x],select))
  32. def rand_4():
  33. l = []
  34. for i in range(4):
  35. l.append(random.randint(0,20))
  36. return l