Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To declare a function you can just follow this scheme

def function_name(<arguments>):
   "Optional documentation string."
   <Python/Sage instructions, could be multiple lines of code>
   return <variable/expression>

In your case, I guess you'd like to receive G as an argument, so it could be of the form

def ihara( G ):
   <your source code here>
   return Z

For more details on functions you can consult this webpage.