SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class TV:
  2.     def __init__(self):
  3.         self.channel = 1
  4.         self.volumeLevel = 1
  5.         self.on = False
  6.    
  7.     def turnOn(self):
  8.         self.on = True
  9.    
  10.     def turnOff(self):
  11.         self.on = False
  12.    
  13.     def getChannel(self):
  14.         return self.channel
  15.    
  16.     def setChannel(self,channel):
  17.         if self.on and 1<= self.channel <=120:
  18.             self.channel = channel
  19.    
  20.     def getVolume(self):
  21.         return self.volumeLevel
  22.  
  23.     def setVolume(self,volumeLevel):
  24.         if self.on and 1<= self.channel <= 7:
  25.             self.volumeLevel = volumeLevel
  26.    
  27.     def channelUp(self):
  28.         if self.on and self.channel<120:
  29.             self.channel =+1
  30.    
  31.     def channelDown(self):
  32.         if self.on and self.channel>1:
  33.             self.channel =-1
  34.    
  35.     def volumeUp(self):
  36.         if self.on and self.volumeLevel<7:
  37.             self.volumeLevel
  38.    
  39.     def volumeDown(self):
  40.         if self.on and self.volumeDown>1:
  41.             self.volumeLevel -=1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top