[Tutor] Critter

Alan Gauld alan.gauld at btinternet.com
Tue Jun 28 00:47:23 CEST 2011


"Vincent Balmori" <vincentbalmori at yahoo.com> wrote

> Last thing I need to do solve is the __str__ problem. I can print 
> the name
> fine, but everytime I try to put in the self.hunger and self.boredom 
> values
> I get:
>
> TypeError: Can't convert 'int' object to str implicitly

That's right you need to do it explicitly.
Either by using str() or by using a format string.
(see the thread yesterday for that topic)

See one of my earlier posts for the code using a format string.


Alan G 




More information about the Tutor mailing list