Question

I have looked around for a while now and am still unable to find an answer to a method of doing this. I have made a few scripts to solve equations and now am looking for a way to write a script that will allow input of steps into an equation,number and name of variables etc. My idea is to make a script that will take all of these inputs and then write another script that will ask for the numbers in an equation and solve the equation. Any ideas of how to write the first script so that it can create a second?

Also I forgot to mention that I want the newer script to be saved for later use/execution.

Was it helpful?

Solution

Instead of writing a script that creates another script, a better way to solve the problem would be to write functions.

For example, the first function would read the names of variables, etc. and return these data as a dictionary.

Next, you would pass this dictionary into the second function, which, depending on the information stored in the dictionary, would read the remaining inputs and return another dictionary with the inputs.

Then, you could use the data from the returned dictionary to solve the equation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top