Home Foros FOROS PARA AYUDAROS ENTRE VOSOTROS. EL PROFESOR AQUÍ NO RESPONDE Foro Python Duda/error en vídeo Ejercicio POO Vídeo 40

Duda/error en vídeo Ejercicio POO Vídeo 40

Etiquetado: , ,

  • Este debate tiene 1 respuesta, 1 mensaje y ha sido actualizado por última vez el hace 2 años, 4 meses por Fabian España.
Viendo 2 entradas - de la 1 a la 2 (de un total de 2)
  • Autor
    Entradas
  • #18839

    Fabian España
    Participante

    <div style=»color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, ‘Courier New’, monospace; font-size: 14px; line-height: 19px; white-space: pre;»>
    <div><span style=»color: #569cd6;»>class</span> <span style=»color: #4ec9b0;»>Vehiculo</span>():</div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>__init__</span>(<span style=»color: #9cdcfe;»>self</span>, <span style=»color: #9cdcfe;»>color</span>, <span style=»color: #9cdcfe;»>ruedas</span>, <span style=»color: #9cdcfe;»>ancho</span>, <span style=»color: #9cdcfe;»>alto</span>, <span style=»color: #9cdcfe;»>marchas</span>):</div>
    <div>        <span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>color</span>=<span style=»color: #9cdcfe;»>color</span></div>
    <div>        <span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>ruedas</span>=<span style=»color: #9cdcfe;»>ruedas</span></div>
    <div>        <span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>ancho</span>=<span style=»color: #9cdcfe;»>ancho</span></div>
    <div>        <span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>alto</span>=<span style=»color: #9cdcfe;»>alto</span></div>
    <div>        <span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>marchas</span>=<span style=»color: #9cdcfe;»>marchas</span></div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>arrancar</span>(<span style=»color: #9cdcfe;»>self</span>):</div>
    <div>        <span style=»color: #c586c0;»>return</span> <span style=»color: #ce9178;»>»Vehículo arrancando»</span></div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>acelerar</span>(<span style=»color: #9cdcfe;»>self</span>):</div>
    <div></div>
    <div>        <span style=»color: #c586c0;»>return</span> <span style=»color: #ce9178;»>»Acelerando vehículo»</span></div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>frenar</span>(<span style=»color: #9cdcfe;»>self</span>):</div>
    <div></div>
    <div>        <span style=»color: #c586c0;»>return</span> <span style=»color: #ce9178;»>»Frenando Vehículo»</span></div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>saltar</span>(<span style=»color: #9cdcfe;»>self</span>):</div>
    <div></div>
    <div>        <span style=»color: #c586c0;»>return</span> <span style=»color: #ce9178;»>»Vehículo saltando»</span></div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>derrapar</span>(<span style=»color: #9cdcfe;»>self</span>):</div>
    <div></div>
    <div>        <span style=»color: #c586c0;»>return</span> <span style=»color: #ce9178;»>»Vehículo derrapando»</span></div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>girar</span>(<span style=»color: #9cdcfe;»>self</span>):</div>
    <div></div>
    <div>        <span style=»color: #c586c0;»>return</span> <span style=»color: #ce9178;»>»Vehículo girando»</span></div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>marchaAtras</span>(<span style=»color: #9cdcfe;»>self</span>):</div>
    <div></div>
    <div>        <span style=»color: #c586c0;»>return</span> <span style=»color: #ce9178;»>»Vehículo marcha atrás»</span></div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>getDatos</span>(<span style=»color: #9cdcfe;»>self</span>):</div>
    <div></div>
    <div>        <span style=»color: #c586c0;»>return</span> <span style=»color: #ce9178;»>»Este vehículo es de color «</span> + <span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>color</span> + <span style=»color: #ce9178;»>», tiene «</span> + <span style=»color: #4ec9b0;»>str</span>(<span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>ruedas</span>) + <span style=»color: #ce9178;»>» ruedas y «</span> + <span style=»color: #4ec9b0;»>str</span>(<span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>marchas</span>) + <span style=»color: #ce9178;»>» marchas. Sus medidas son «</span> + <span style=»color: #4ec9b0;»>str</span>(<span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>alto</span>) + <span style=»color: #ce9178;»>» centrimetros de alto y «</span> + <span style=»color: #4ec9b0;»>str</span>(<span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>ancho</span>) + <span style=»color: #ce9178;»>» centrimetros de ancho.»</span></div>
    <div></div>
    <div></div>
    <div><span style=»color: #569cd6;»>class</span> <span style=»color: #4ec9b0;»>Furgoneta</span>(<span style=»color: #4ec9b0;»>Vehiculo</span>):</div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>__init__</span>(<span style=»color: #9cdcfe;»>self</span>, <span style=»color: #9cdcfe;»>color</span>, <span style=»color: #9cdcfe;»>ruedas</span>, <span style=»color: #9cdcfe;»>ancho</span>, <span style=»color: #9cdcfe;»>alto</span>, <span style=»color: #9cdcfe;»>marchas</span>, <span style=»color: #9cdcfe;»>carga</span>):</div>
    <div>        <span style=»color: #4ec9b0;»>super</span>().<span style=»color: #dcdcaa;»>__init__</span>(<span style=»color: #9cdcfe;»>self</span>, <span style=»color: #9cdcfe;»>color</span>, <span style=»color: #9cdcfe;»>ruedas</span>, <span style=»color: #9cdcfe;»>ancho</span>, <span style=»color: #9cdcfe;»>alto</span>, <span style=»color: #9cdcfe;»>marchas</span>)</div>
    <div></div>
    <div>        <span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>carga</span>=<span style=»color: #9cdcfe;»>carga</span></div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>getDatos</span>(<span style=»color: #9cdcfe;»>self</span>):</div>
    <div></div>
    <div>        <span style=»color: #c586c0;»>return</span> <span style=»color: #4ec9b0;»>super</span>().<span style=»color: #dcdcaa;»>getDatos</span>() + <span style=»color: #ce9178;»>»El  vehículo tiene una capacidad carga de «</span> + <span style=»color: #4ec9b0;»>str</span>(<span style=»color: #9cdcfe;»>self</span>.<span style=»color: #9cdcfe;»>carga</span>) + <span style=»color: #ce9178;»>» kilos.»</span></div>
    <div>    <span style=»color: #569cd6;»>def</span> <span style=»color: #dcdcaa;»>cargar</span>(<span style=»color: #9cdcfe;»>self</span>):</div>
    <div></div>
    <div>        <span style=»color: #c586c0;»>return</span> <span style=»color: #ce9178;»>»Vehículo cargando»</span></div>
    <div></div>
    <div></div>
    <div><span style=»color: #569cd6;»>class</span> <span style=»color: #4ec9b0;»>Bicicleta</span>(<span style=»color: #4ec9b0;»>Vehiculo</span>):</div>
    <div>    <span style=»color: #c586c0;»>pass</span></div>
    <div><span style=»color: #569cd6;»>class</span> <span style=»color: #4ec9b0;»>Coche</span>(<span style=»color: #4ec9b0;»>Vehiculo</span>):</div>
    <div>    <span style=»color: #c586c0;»>pass</span></div>
    <div><span style=»color: #569cd6;»>class</span> <span style=»color: #4ec9b0;»>Moto</span>(<span style=»color: #4ec9b0;»>Vehiculo</span>):</div>
    <div>    <span style=»color: #c586c0;»>pass</span></div>
    <div><span style=»color: #9cdcfe;»>mifurgo</span>=<span style=»color: #4ec9b0;»>Furgoneta</span>(<span style=»color: #ce9178;»>»Verde»</span>, <span style=»color: #b5cea8;»>6</span>, <span style=»color: #b5cea8;»>400</span>, <span style=»color: #b5cea8;»>212</span>, <span style=»color: #b5cea8;»>6</span>, <span style=»color: #b5cea8;»>1500</span>)</div>
    <div><span style=»color: #dcdcaa;»>print</span>( <span style=»color: #ce9178;»>»—————————————————————————«</span> )</div>
    <div><span style=»color: #dcdcaa;»>print</span>(<span style=»color: #9cdcfe;»>mifurgo</span>.<span style=»color: #dcdcaa;»>getDatos</span>())</div>
    <div><span style=»color: #dcdcaa;»>print</span>( <span style=»color: #ce9178;»>»—————————————————————————«</span> )</div>
    </div>
    <div></div>
    <div></div>
    <div>Buenas!</div>
    <div></div>
    <div>Estoy cursando Python, estoy en el vídeo 40 de POO en Python. En este video Juan nos pide que realicemos un ejercicio aplicando la herencia simples y las multiples.</div>
    <div></div>
    <div>No entiendo porque al compilar mi código me indica este error :</div>
    <div></div>
    <div>TypeError: Vehiculo.__init__() takes 6 positional arguments but 7 were given</div>
    <div></div>
    <div>No entiendo porque me dice que son 7 parámetros cuando le estoy pasando 6. ¿Cómo puedo solucionar esto?</div>
    <div></div>
    <div>Gracias</div>
    <div></div>
    <div></div>

    #18840

    Fabian España
    Participante

    <b id=»docs-internal-guid-9195713c-7fff-4b74-76a3-46e5bfaf35f3″ style=»font-weight: normal;»>

    </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>class Vehiculo():</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def __init__(self, color, ruedas, ancho, alto, marchas):</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        self.color=color</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        self.ruedas=ruedas</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        self.ancho=ancho</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        self.alto=alto</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        self.marchas=marchas</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def arrancar(self):</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        return «Vehículo arrancando»</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def acelerar(self):</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        return «Acelerando vehículo»</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def frenar(self):</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        return «Frenando Vehículo»</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def saltar(self):</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        return «Vehículo saltando»</span></p>
    <b style=»font-weight: normal;»>

    </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def derrapar(self):</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        return «Vehículo derrapando»</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def girar(self):</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        return «Vehículo girando»</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def marchaAtras(self):</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        return «Vehículo marcha atrás»</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def getDatos(self):</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        return «Este vehículo es de color » + self.color + «, tiene » + str(self.ruedas) + » ruedas y » + str(self.marchas) + » marchas. Sus medidas son » + str(self.alto) + » centrimetros de alto y » + str(self.ancho) + » centrimetros de ancho.»</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>            </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>class Furgoneta(Vehiculo):</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def __init__(self, color, ruedas, ancho, alto, marchas, carga):</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        super().__init__(self, color, ruedas, ancho, alto, marchas)</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        self.carga=carga</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def getDatos(self):</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        return super().getDatos() + «El  vehículo tiene una capacidad carga de » + str(self.carga) + » kilos.»</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    def cargar(self):</span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        return «Vehículo cargando»        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>        </span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>class Bicicleta(Vehiculo):</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    pass</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>class Coche(Vehiculo):</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    pass</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>class Moto(Vehiculo):</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>    pass</span></p>
    <b style=»font-weight: normal;»>

    </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>mifurgo=Furgoneta(«Verde», 6, 400, 212, 6, 1500)</span></p>
    <b style=»font-weight: normal;»>

    </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>print( «—————————————————————————» )</span></p>
    <b style=»font-weight: normal;»> </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>print(mifurgo.getDatos())</span></p>
    <b style=»font-weight: normal;»>

    </b>
    <p dir=»ltr» style=»line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;»><span style=»font-size: 11pt; font-family: Arial; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;»>print( «—————————————————————————» )</span></p>
     

Viendo 2 entradas - de la 1 a la 2 (de un total de 2)
  • Debes estar registrado para responder a este debate.