clase 7
This commit is contained in:
parent
6aa87585a6
commit
d3dada2708
5
clase_7/main.py
Normal file
5
clase_7/main.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from ppo import Auto
|
||||
|
||||
auto_1 = Auto ("Verde","Renault","clio", 100)
|
||||
|
||||
print(auto_1.getVelocidad())
|
||||
29
clase_7/ppo.py
Normal file
29
clase_7/ppo.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
class Auto:
|
||||
color= "amarillo"
|
||||
marca= "fiat"
|
||||
modelo= "toro"
|
||||
velocidad= 120
|
||||
|
||||
def __init__(self,color,marca,modelo,velocidad):
|
||||
self.color=color
|
||||
self.marca=marca
|
||||
self.modelo= modelo
|
||||
self.velocidad= velocidad
|
||||
|
||||
|
||||
def acelerar(self):
|
||||
self.velocidad +=1
|
||||
|
||||
def frenar(self):
|
||||
self.velocidad -= 1
|
||||
|
||||
def getVelocidad(self):
|
||||
return self.velocidad
|
||||
|
||||
def setColor(self, color):
|
||||
self.color= color
|
||||
|
||||
def getColor(self):
|
||||
return self.color
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user