Preview:
class Vehiculo():

    def __init__(self, color, ruedas):
        self.color = color
        self.ruedas = ruedas

        print("\n El vehículo se ha creado con éxito!")

    def __str__(self):
        info = "Color: " + self.color + "\n Ruedas: " + str(self.ruedas)
        return info


class Coche(Vehiculo):

    def __init__(self, color, ruedas, velocidad, cilindrada):
        self.velocidad = velocidad
        self.cilindrada = cilindrada

        super().__init__(color, ruedas)

    def __str__(self):
        info = "\n Coche \n Color: " + self.color + "\n Ruedas: " + str(self.ruedas) + "\n Velocidad: " + str(
            self.velocidad) + "\n Cilindrada: " + str(self.cilindrada)
        return info


class Camioneta(Coche):

    def __init__(self, color, ruedas, carga, velocidad, cilindrada):
        self.carga = carga

        super().__init__(color, ruedas, velocidad, cilindrada)

    def __str__(self):
        info = "\n Camioneta \n Color: " + self.color + "\n Ruedas: " + str(self.ruedas) + "\n Carga: " + str(
            self.carga) + "\n Velocidad: " + str(self.velocidad) + "\n Cilindrada: " + str(self.cilindrada)

        return info


class Bicicleta(Vehiculo):

    def __init__(self, color, ruedas, tipo):
        self.tipo = tipo

        super().__init__(color, ruedas)

    def __str__(self):
        info = "\n Bicicleta \n Color: " + self.color + "\n Ruedas: " + str(self.ruedas) + "\n Tipo: " + self.tipo
        return info


class Motocicleta(Bicicleta):

    def __init__(self, color, ruedas, tipo, velocidad, cilindrada):
        self.velocidad = velocidad
        self.cilindrada = cilindrada

        super().__init__(color, ruedas, tipo)

    def __str__(self):
        info = "\n Motocicleta \n Color: " + self.color + "\n Ruedas: " + str(
            self.ruedas) + "\n Tipo: " + self.tipo + "\n Velocidad: " + str(self.velocidad) + "\n Cilindrada: " + str(
            self.cilindrada)
        return info


coche1 = Coche("Rojo", 4, 200, 500)
# print(coche1)

motocicleta1 = Motocicleta("Azul", 2, "A", 100, 50)
# print(motocicleta1)

bicicleta1 = Bicicleta("Blanco", 2, "GX")
# print(bicicleta1)

camioneta1 = Camioneta("Blanco", 6, 500, 80, 500)
# print(camioneta1)


lista = {coche1, motocicleta1, bicicleta1, camioneta1}


def catalogar(i):

    for i in lista:

        print(type(i).__name__, i)

catalogar(lista)

def ruedas(ruedas):

    if ruedas == "2":

        print("Se ha encontrado 2 vehículos con 2 ruedas")
    elif ruedas == "4":

        print("Se ha encontrado 1 vehículo con 4 ruedas")

    elif ruedas == "6":

        print("Se ha encontrado 1 vehículo con 6 ruedas")

    else:
        print("No se ha encontrado ningún vehículo")

x = str(input("Elige un número de ruedas: "))
ruedas(x)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter