-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay 11.py
More file actions
38 lines (29 loc) · 838 Bytes
/
Day 11.py
File metadata and controls
38 lines (29 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class RemoteTv():
def __init__(self):
self.switchIsOn = False
self.brightness = 0
def turnOn(self):
self.switchIsOn = True
def turnOff(self):
self.switchIsOn = False
def raiseLevel(self):
if self.brightness < 10:
self.brightness = self.brightness + 1
def lowerLevel(self) :
if self.brightness > 0:
self.brightness = self.brightness - 1
def show(self):
print('Switch is on ?', self.switchIsOn)
print('Brightness is:', self.brightness)
remoteSatu = RemoteTv()
remoteSatu.turnOn()
remoteSatu.raiseLevel()
remoteSatu.raiseLevel()
remoteSatu.raiseLevel()
remoteSatu.raiseLevel()
remoteSatu.raiseLevel()
remoteSatu.show()
remoteSatu.lowerLevel()
remoteSatu.lowerLevel()
remoteSatu.turnOff()
remoteSatu.show()