| 1 | initial version |
Note that your script is not pure Python since it relies on the Sage preparser (e.g. you use ^ for power while in Python it should be **).
You can put this into a file with a .sage extension, for example myscript.sage so that Sage will understand that the script has to be preparsed, then you can call the script either from the terminal with
./sage myscript.sage
or from the Sage console with:
%runfile myscript.sage
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.