On Mar 20, 6:18 pm, Noah Hall <enali...@gmail.com> wrote: > > class Message: > > def __init__(self,string1,string2,lenstr1,lenstr2): > > self.string1="MY" > > self.string2="NAME" > > self.lenstr1=lenstr1 > > self.lenstr2=lenstr2 > > The variables string1 and string2 that you're passing here are in fact > useless. They don't do anything inside the method. Is there any point > for them? There's no need to pass __init__ variables just so you can > assign self.variable_name = "fixed text". > > > def lenstring(self): > > lenstr1=len(self.string1) > > lenstr2=len(self.string2) > > I think you want self.lenstr1 and self.lenstr2 here - otherwise you're > assigning local variables with the same name as those defined within > the class, and throwing them away. > > > def printstr(self): > > print lenstr1 > > print lenstr2 > > Again, I think you want self.lenstr1 and self.lenstr2
Sir, It worked. Just Thanks. Best Regards, Subhabrata. -- http://mail.python.org/mailman/listinfo/python-list