Functions, Control, and Getting Help
  • Getting Help. Sage has extensive built-in documentation, accessible by typing the name of a function or a constant (for example), followed by a question mark.
  • Defining Functions. To define a new function in Sage, use the def command and a colon after the list of variable names.
  • Counting and Iteration. In Sage, you count by iterating over a range of integers.
  • Iteration, Tables, and String Formatting. One easy way to print a table with a {for}} loop is to use string formatting.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License