-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathejemploClases.py
140 lines (124 loc) · 4.09 KB
/
ejemploClases.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
class Tele:
_TV = ['''
___________________
| |
| |
| |
|____________________|
||
__/ \__ ''',
'''
____________________
| ____ |
| | \ / |
| | \/ |
|____________________|
||
__/ \__ ''', '''
____________________
| |
| CHANEL |
| 1 |
|____________________|
||
__/ \__ ''', '''
____________________
| |
| CHANEL |
| 2 |
|____________________|
||
__/ \__ ''', '''
____________________
| |
| CHANEL |
| 3 |
|____________________|
||
__/ \__ ''', '''
____________________
| |
| CHANEL |
| 4 |
|____________________|
||
__/ \__ ''', '''
____________________
| |
| CHANEL |
| 5 |
|____________________|
||
__/ \__ ''', '''
____________________
| |
| CHANEL |
| 6 |
|____________________|
||
__/ \__ ''', '''
____________________
| |
| CHANEL |
| 7 |
|____________________|
||
__/ \__ ''',
]
def __init__(self, _is_turned_on):
self._is_turned_on = _is_turned_on
self._change_= 0
def turn_on(self):
self._is_turned_on = True
self._display_image()
def turn_off(self):
self._is_turned_on = False
self._display_image()
def change_chanel_up(self):
if self._is_turned_on == False:
self._display_image()
else:
if self._change_== 7:
self._change_ = 0
self._change_ = self._change_ + 1
self._display_image()
def change_chanel_down(self):
if self._is_turned_on == False:
self._display_image()
else:
self._change_=self._change_ - 1
if self._change_ == 0:
self._change_ = 7
elif self._change_ == -1:
self._change_ = 7
self._display_image()
def _display_image(self):
if self._is_turned_on == True:
if self._change_ == 0:
print(self._TV[1])
else:
print(self._TV[self._change_ + 1])
elif self._is_turned_on == False:
print(self._TV[0])
def run():
tv= Tele(_is_turned_on = False)
while True:
command = str(input('''
¿Qué deseas hacer?
[p] render
[a] pagar
[u] cambiar arriba
[d] cambiar abajo
[s] salir'''))
if command == 'p':
tv.turn_on()
elif command == 'a':
tv.turn_off()
elif command == 'u':
tv.change_chanel_up()
elif command == 'd':
tv.change_chanel_down()
else:
break
if __name__ == "__main__":
run()