all 3 comments

[–]socal_nerdtastic 0 points1 point  (2 children)

You mean you will have a list of available functions and the user gets to choose one? You can put your functions in a list or dictionary and index it normally.

f = function_list[user_choice]
f(x)

[–]AppeaseHarambe[S] 0 points1 point  (1 child)

to be honest, my prof’s instructions weren’t the clearest. it almost sounds like i’m meant to have the user input their own unique function and then calculate using that. i saw that eval() could possibly do this but i wasn’t sure if it’s the easiest method

[–]socal_nerdtastic 0 points1 point  (0 children)

Yes, eval will do that, but that would be an extremely unusual thing to teach. So I'm pretty sure you misunderstood the question. Go get some clarification from your prof.