On Wed, Oct 24, 2012 at 11:11 PM, inshu chauhan <insidesh...@gmail.com> wrote: > print " Adding twice of %4.2f gives " % (y.addtwice()) > > > Error is : > > Traceback (most recent call last): > File "Z:\learning Python\learn5.py", line 35, in <module> > print " Adding twice of %4.2f gives " % (y.addtwice()) > TypeError: addtwice() takes exactly 2 arguments (1 given) > > why the prog is having this error with self nd x as arguments ???
The first argument is 'self', which is being passed y, but you also need to pass it a value to add twice. You're ignoring the argument to __init__ so I don't know what your purpose is, but possibly you should be saving that into self somewhere?? ChrisA -- http://mail.python.org/mailman/listinfo/python-list