Re: [Tutor] Error when calling a class

2007-02-18 Thread Kent Johnson
Rikard Bosnjakovic wrote: > On 2/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> import classctof >> y=classctof.fahrenheit(1) >> print y >> >> What am I doing wrong to get it to pass the answer back to the calling >> program? > > You need to instancify the class first before calling its

Re: [Tutor] Error when calling a class

2007-02-18 Thread Rikard Bosnjakovic
On 2/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > import classctof > y=classctof.fahrenheit(1) > print y > > What am I doing wrong to get it to pass the answer back to the calling > program? You need to instancify the class first before calling its methods: import classctof # make an

[Tutor] Error when calling a class

2007-02-18 Thread [EMAIL PROTECTED]
I'm learning about creating classes and have created the simple class below: class Temperature (object): def fahrenheit(self): return 32 + (1.8 * self.celsius) d = Temperature() d.celsius = float(input()) print d.fahrenheit() This works fine stand-alone but I can't get it to wor