[Tutor] calculate the sum of a variable - python

Wayne Werner waynejwerner at gmail.com
Mon Mar 7 06:11:25 CET 2011


On Sun, Mar 6, 2011 at 10:46 PM, nookasree ponamala <nookasree at yahoo.com>wrote:

> Thanks for the reply Wayne, but still it is not working,
>
> when I used int It throws the below error:
>   File "<stdin>", line 2, in <module>
>   File "<stdin>", line 3, in summary
>   File "<stdin>", line 3, in <genexpr>
> ValueError: invalid literal for int() with base 10: "'"
>

It gives you a single-quote character that apparently you are trying to turn
into a number. I'm not exactly sure what the problem is there - you should
probably unwrap your generator expression into the equivalent loop(s) and
either insert some strategic print statements or use a debugger, such as the
python debugger.

HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110306/fd35bb5e/attachment.html>


More information about the Tutor mailing list