Re: [Tutor] On off Toggle

2011-03-12 Thread David Hutto
You want toggle_power to turn on or off. class Television(object): def __init__(self): pass def toggle_power(self, choice): if choice == 0: poweroff() if choice == 1: poweron() # you set a choice that won't work unless user says choice =

Re: [Tutor] On off Toggle

2011-03-12 Thread Alan Gauld
"Adrian Atkinson" wrote class Television(object): While using a class is not in itself a bad idea it looks like you have much more fundamental issues to deal with so I'd suggest dropping the class for now and just write some functions using global variables to store the data. You can then mo

[Tutor] On off Toggle

2011-03-12 Thread Adrian Atkinson
class Television(object): def __init__(self,__channel,volume,is_on): self.volume = volume self.is_on = "Power is off" power = self.is_on def toggle_power(self): if choice == "1" and power == self.is_on : power = "Power is Now on" elif c