I”m coding in python and I’m trying to use my function get_formula to get the mathematical formula of an itertools.combinations variable which is set to a function. I haven’t gotten the code that I’m using for that function yet but I’m looking for someone to help show me how I can first get the order of iterables formula so I can put it in there later. I want a mathematical formula describing the order of all the combinations.
My code so far is:
from itertools import combinations
def function3():
#Just a placeholder for my actual code
return range(0,300)
def get_formula(itertools):
#Where I want to inject some code into my combinations function so I can get the formula
return itertools
combinations0 = combinations(function3(),len(function3()))
combinations1 = get_formula(combinations0)
As you can see in the get_formula function I’m looking to like do something like inject code into combinations0 so I can get the formula generated by python automatically. That’s all I’m looking to do right now. In the function get_formula at the end it will print the generated mathemeatical formula describing the order of the combinations.
ashlyn abee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1