Hi I got the complete code, but I don't know how to run the script. The script is some plot of a function, can one run the script so that the plot is shown in xcode?
You don't need to use Xcode. Just open Terminal and run:
For making an Xcode project for a python script: https://stackoverflow.com/questions/5276967/
You must include the python you use into the xcode build scheme after that you can run python scripts in xcode.
here is the detailed explanation on how to do that.
But your only goal is to run the script and view the plot, running the code in terminal is the better option to do that.