Everything worked once I placed semicolons after each line in the
definition of the function.

On Oct 21, 5:22 pm, "D. S. McNeil" <dsm...@gmail.com> wrote:
> Hi!
>
> I'm not sure what you mean by
>
> > Also if I have the terms, and return on separate lines in the
> > definition then I get this error.
>
> You _have_ to have the different statements on separate lines, like I
> did.  (Unless you use a semicolon to separate the statements, I
> suppose.)  Did you combine them?  It looks like you did but it's hard
> to be sure because sometimes carriage returns are lost during the
> cut-and-paste process.
>
> Paying attention to the syntax is even more important Python than in
> many other languages because Python is whitespace-sensitive-- if you
> don't use the right indentation, the code might not work.  I think it
> might be useful to read through a Python tutorial if you're more
> familiar with the syntax from other languages.  It won't take too long
> but may clear up some of the confusion.
>
> As for the NameError:
>
> > Well I did use your method but I still get an error.
>
> Actually, it doesn't look like you did use my code.  You modified the
> last line to read "return term1 + term2 if t != 0 else infinity",
> thereby introducing a variable t which you hadn't defined, which leads
> to the NameError explaining -- reasonably enough -- that you're
> referring to a name 't' which you didn't define.
>
> Does that make sense?
>
> Doug

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to