ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 16 Dec 2019 15:13:16 +0100Running Python code from Jupyter and transforming it in a Sage functionhttps://ask.sagemath.org/question/48995/running-python-code-from-jupyter-and-transforming-it-in-a-sage-function/ I would like to know if it is possible to run a python code directly within a notebook and transform it in a sagemath function. The problem is that I am nearly sure that is possible, but I do not know how to install it --- I am under windows an a poor programmer.
For instance if some one has to kindness to take as an exemple https://github.com/fordc5/PrisonersDilemmaCSWorkshop, it will be great.Wed, 11 Dec 2019 10:01:06 +0100https://ask.sagemath.org/question/48995/running-python-code-from-jupyter-and-transforming-it-in-a-sage-function/Comment by Iguananaut for <p>I would like to know if it is possible to run a python code directly within a notebook and transform it in a sagemath function. The problem is that I am nearly sure that is possible, but I do not know how to install it --- I am under windows an a poor programmer.</p>
<p>For instance if some one has to kindness to take as an exemple <a href="https://github.com/fordc5/PrisonersDilemmaCSWorkshop">https://github.com/fordc5/PrisonersDi...</a>, it will be great.</p>
https://ask.sagemath.org/question/48995/running-python-code-from-jupyter-and-transforming-it-in-a-sage-function/?comment=49049#post-id-49049Aside from Emmanuel's answer, which is correct, it's not really clear to me what you tried to do or what problem you had. When you write "The problem is that I am nearly sure that is possible, but I do not know how to install it" I'm not sure what you mean by "install it". Install what?Mon, 16 Dec 2019 15:13:16 +0100https://ask.sagemath.org/question/48995/running-python-code-from-jupyter-and-transforming-it-in-a-sage-function/?comment=49049#post-id-49049Answer by Emmanuel Charpentier for <p>I would like to know if it is possible to run a python code directly within a notebook and transform it in a sagemath function. The problem is that I am nearly sure that is possible, but I do not know how to install it --- I am under windows an a poor programmer.</p>
<p>For instance if some one has to kindness to take as an exemple <a href="https://github.com/fordc5/PrisonersDilemmaCSWorkshop">https://github.com/fordc5/PrisonersDi...</a>, it will be great.</p>
https://ask.sagemath.org/question/48995/running-python-code-from-jupyter-and-transforming-it-in-a-sage-function/?answer=49001#post-id-49001(Preparsed) Sage code **is** essentially Python code... The difference are minor, and mostly introduced by the preparser or the use of Sage-specific functions. So pasting Python code in a Sage notebook should (mostly) work...
This [page](https://doc.sagemath.org/) may give you some useful pointers... This [document](http://sagebook.gforge.inria.fr/english.html) is a useful introduction.Wed, 11 Dec 2019 22:07:34 +0100https://ask.sagemath.org/question/48995/running-python-code-from-jupyter-and-transforming-it-in-a-sage-function/?answer=49001#post-id-49001