-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclase.py
More file actions
35 lines (27 loc) · 675 Bytes
/
clase.py
File metadata and controls
35 lines (27 loc) · 675 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
#CLASE
class Auto:
# CONTRUCTOR
def __init__(self,nombre_cons,color,motor):
# ATRIBUTOS
self.nombre = nombre_cons
self.color = color
self.ruedas = "4"
self.motor = motor
# METODOS
def arranca(self):
print("RRRUUNNN el", self.nombre)
def frena(self):
print("frenando el", self.nombre)
def get_color(self):
print(self.color)
def set_color(self,new_color):
self.color = new_color
mustang = Auto('MUSTANG','ROJO', '5.5')
mustang.arranca()
mustang.frena()
mustang.set_color('azul')
mustang.get_color()
jetta = Auto('JETTA','BLANCO', '2.5')
jetta.arranca()
jetta.frena()
jetta.get_color()