I'm writing a program that, among other things, takes in user input for the entries of a matrix. These entries currently can be integers or floats - like
value_list.append(float(input("what value for position _, _: ")))
#value_list is then resized into a numpy matrix
(There's more to it than this, but this is basically what I'm doing.)
It would be much more useful for the user to be able to input square roots, imaginary numbers, and constants like pi or e. Looking around on the internet, I quickly found the eval()
function, but this seems like a poor solution. What other options do I have?