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.
39 lines
799 B
39 lines
799 B
from uniPerm import perms
|
|
from math import log
|
|
import random
|
|
from sympy.core.sympify import sympify
|
|
from sympy.simplify.simplify import simplify
|
|
def con_base(n,b):
|
|
out = []
|
|
if n == 0:
|
|
return [0]
|
|
for p in range(int(log(n,b)),-1,-1):
|
|
out.append(n//(b**p))
|
|
n %= b**p
|
|
return out
|
|
def zp(lst,n):
|
|
l = []
|
|
for i in range(n-len(lst)):
|
|
l.append(0)
|
|
return l + lst
|
|
|
|
def getInput(blah):
|
|
sanitized = list(
|
|
filter(
|
|
lambda x: x,blah.split(' ')
|
|
)
|
|
)
|
|
return list(
|
|
map(
|
|
lambda x: int(x),sanitized
|
|
)
|
|
)
|
|
|
|
def choose(lst,select):
|
|
return list(map(lambda x: lst[x],select))
|
|
|
|
def rand_4():
|
|
l = []
|
|
for i in range(4):
|
|
l.append(random.randint(0,20))
|
|
return l
|