I want to make simple program that asks user what function (mathematical) he wants to see
and then program draws it with turtle. I have drawing done but user input is tricky, I am sure you can't do that in one line of code but how to convert the input (string) into something like x * 10 + 30 - x
, that can be put in function call
Ex.:
function(x, x * 10 + 30 - x)
My code:
print("Give function you want to see, don't do '2x', do 'x * 2', after and before signs like '+ * /' do space, USE ONLY X AND NUMBERS")
print("Example: x * x + 10 - x * 2")
print("Give function you want: ")
functionS = input()
def drawNewThing(x, function):
goto(x * 2, function)
for i in range(100):
drawNewThing(i, functionS)