Ask Your Question

Revision history [back]

I'm guessing that for both questions, you are using the command-line interface.

First question: type "q". If you type "help()" from the "sage:" prompt, you'll get a message including this paragraph:

(When you type something like "matrix_plot?", "help(matrix_plot)", or "matrix_plot??", Sage may start a paging program to display the requested message. Type a space to scroll to the next page, type "h" to get help on the paging program, and type "q" to quit it and return to the "sage:" prompt.)

(If you're using the notebook instead, just go to the next cell.)

Second question: are you typing the dots "..."? Don't do that. Make sure that the spacing is exactly as displayed in the tutorial.

sage: class Evens(list):
...       def __init__(self, n):
...           self.n = n
...           list.__init__(self, range(2, n+1, 2))
...       def __repr__(self):
...           return "Even positive numbers up to n."
...

When I'm using Sage, after I type the first line, the cursor is already in the right place to type the second line, and the same after the second line. After the fourth line "list.__init__(...)", you will need to hit the backspace key 4 times to get to the right indentation level.

(If you're using the notebook instead, type this in one cell in your worksheet:

class Evens(list):
    def __init__(self, n):
        self.n = n
        list.__init__(self, range(2, n+1, 2))
    def __repr__(self):
        return "Even positive numbers up to n."

Don't type "sage:" and don't type the dots "...".)

I'm guessing that for both questions, you are using the command-line interface.

First question: type "q". If you type "help()" from the "sage:" prompt, you'll get a message including this paragraph:

(When you type something like "matrix_plot?", "help(matrix_plot)", or "matrix_plot??", Sage may start a paging program to display the requested message. Type a space to scroll to the next page, type "h" to get help on the paging program, and type "q" to quit it and return to the "sage:" prompt.)

(If you're using the notebook instead, just go to the next cell.)

Second question: are you typing the dots "..."? Don't do that. Make sure that the spacing is exactly as displayed in the tutorial.

sage: class Evens(list):
...       def __init__(self, n):
...           self.n = n
...           list.__init__(self, range(2, n+1, 2))
...       def __repr__(self):
...           return "Even positive numbers up to n."
...

When I'm using Sage, after I type the first line, the cursor is already in the right place to type the second line, and the same after the second line. After the fourth line "list.__init__(...)", you will need to hit the backspace key 4 times to get to the right indentation level.level. After the last line "return ...", hit return twice.

(If you're using the notebook instead, type this in one cell in your worksheet:

class Evens(list):
    def __init__(self, n):
        self.n = n
        list.__init__(self, range(2, n+1, 2))
    def __repr__(self):
        return "Even positive numbers up to n."

Don't type "sage:" and don't type the dots "...".)