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 = 1000 #you giv an off on status Off = 0 On = 1 You start the loop instance while choice != 0: #Ask for input 0 or 1 choice = raw_input("Power on = 1, power off = 0 . Press 1, or 0 : ") #give an instance for the class tv = Television() #give class and function instance to call toggle_power tv.toggle_power(choice) once the function is called, the choice is passed to the function and the poweron(), or poweroff() function is called. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor