-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexodo.py
More file actions
executable file
·34 lines (30 loc) · 817 Bytes
/
exodo.py
File metadata and controls
executable file
·34 lines (30 loc) · 817 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
class Controle:
def __init__(self):
self.ch = 5
self.tvligada = False
def canal(self,canal = None):
if canal:
if self.tvligada:
self.ch = canal
print("Mudou o canal para:", self.ch)
else:
print("Você precisa ligar a TV para mudar de canal")
else:
return self.ch
def botao_ligar_tv(self):
if self.tvligada :
self.tvligada = False # desliga
print("TV desligada.")
else:
self.tvligada = True # liga
print("TV ligada no canal", self.canal())
return self.tvligada
tv = Controle()
tv.botao_ligar_tv()
tv.canal(10)
tv.botao_ligar_tv()
tv.canal(4)
tv.botao_ligar_tv()
tv.canal(4)
tv.botao_ligar_tv()
tv.botao_ligar_tv()