On Sun, Jun 26, 2011 at 8:28 PM, Vincent Balmori <vincentbalm...@yahoo.com> wrote: > > I made in elif statement for the channel changer that works for it, but the > volume systems system boundary does not the way I want it to. If the volume > is 2 and I lower it by a value of 5, it will accept the volume at a negative > number thus going past the boundary. The vice-versa for the high boundary as > well. > > http://old.nabble.com/file/p31932639/TV.py TV.py
In this case, you're testing in the wrong place again. >def volume_down(tv, down = 1): Again, no need for the variable "down" - you don't use it. > if tv.volume > tv.volume_lowboundary : tv.volume is always going to be less than tv.volume_lowboundary unless set via calling tv.volume = <some_value> externally. > down = int(input("\n How much do you want to lower the volume?: ")) Note you haven't got any error catching. What happens if I enter "mouse"? > if down > 10: > int(input("\n That's too much! Choose another number?: ")) Here you need an elif clause, checking if down is too low, for example, elif tv.volume - down >1: > else: > tv.volume -= down > print("\n The volume is now:", tv.volume) > if tv.volume == 0: > print("\nVolume is at lowest value.") HTH _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor