2
I created a module with two classes: I want to use both as if the mouse depended on the computer. E.g.: when using them: only when the Computer is turned on does the mouse have permission to turn on (plugged in).. otherwise display a message that he cannot plug in...
But I did not succeed as shown in the code below:
Can someone help me and tell me where I went wrong, please?
from time import sleep
class Computador:
    def __init__(self, marca, ligado=False, desligado=False):
        self.marca = marca
        self.ligado = ligado
        self.desligado = desligado
    def ligar(self):
        if self.ligado:
            print(f'{self.marca}, já está ligado')
            return
        print(f'{self.marca} está ligado')
        self.ligado = True
    def desligar(self):
        if self.desligado:
            print(f'{self.marca}, já está desligado')
            return
        print(f'{self.marca} está desligado')
        self.desligado = True
class Mouse(Computador):
    def __init__(self, marca):
        super().__init__(marca)
        self.marca = marca
        self.plugado = False
        self.desplugado = False
    def plugar(self):
        if not self.desligado or not self.ligado:
            print(f'O {self.marca} não está conectando o mouse..')
            return
        print(f'{self.marca} está conectando...')
        sleep(1)
        print(f'{self.marca} plugando...')
        sleep(2)
        print('Pronto!')
        sleep(1)
    def desplugar(self):
        return
# Essa é a Segunda Parte do Código onde estou chamando os objetos/funções:
from classes import Computador, Mouse
c1 = Computador('Dell', 'Mouse RedDragon')
m1 = Mouse('RedDragon')
print(f'Descrição: [1]{c1.marca}\n')
m1.plugar()
c1.ligar()
c1.desligar()
c1.desligar()
c1.ligar()
m1.plugar()
Show me what I’m not doing right, please.
Thank you very much for the edition.
– Hyago Santos
What would be the level of this content, since it is not Beginner Wallace Maxters , could tell me to edit, please??
– Hyago Santos