One of my favorites was to organize and invoke multiple packages and functions with a Dictionary. Code:
def case1(x,y):
return x+y+x, "X+Y+X"
def case2(x):
import itertools
kb = list(itertools.chain(*x)), "Chain "
return kb
def case3(x):
return [z*2 for z in x for z in z if z%2==0], "Process"
def case4():
! pip install --upgrade pip
probs={
"Add": case1,
"Chain": case2,
"Action": case3,
"Update": case4
}
#switchcase #dictionary #functions