From 6996735bbe59b003de896214434936e18c82d491 Mon Sep 17 00:00:00 2001 From: Everton Reis Date: Wed, 16 Nov 2022 09:33:33 -0400 Subject: [PATCH 1/3] diretorio OO --- oo/__init__.py | 0 oo/pessoa.py | 2 ++ venv/pyvenv.cfg | 3 +++ 3 files changed, 5 insertions(+) create mode 100644 oo/__init__.py create mode 100644 oo/pessoa.py create mode 100644 venv/pyvenv.cfg diff --git a/oo/__init__.py b/oo/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/oo/pessoa.py b/oo/pessoa.py new file mode 100644 index 000000000..e6820529f --- /dev/null +++ b/oo/pessoa.py @@ -0,0 +1,2 @@ +class Pessoa: + pass \ No newline at end of file diff --git a/venv/pyvenv.cfg b/venv/pyvenv.cfg new file mode 100644 index 000000000..10427d270 --- /dev/null +++ b/venv/pyvenv.cfg @@ -0,0 +1,3 @@ +home = /Library/Developer/CommandLineTools/usr/bin +include-system-site-packages = false +version = 3.8.2 From d4288459978bfd41c9b75dc1e1bda5bce4fef94e Mon Sep 17 00:00:00 2001 From: Everton Reis Date: Wed, 16 Nov 2022 09:56:49 -0400 Subject: [PATCH 2/3] Criado atributo de instancia nome e idade --- oo/pessoa.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/oo/pessoa.py b/oo/pessoa.py index e6820529f..504480554 100644 --- a/oo/pessoa.py +++ b/oo/pessoa.py @@ -1,2 +1,15 @@ class Pessoa: - pass \ No newline at end of file + def __init__(self, nome = None, idade=30): + self.idade = idade + self.name = nome + + def cumprimentar(self): + return f'Olá {id(self)}' + +if __name__ == '__main__': + p = Pessoa('Simone') + print(p.cumprimentar()) + print(p.name) + p.name = 'Everton Reis' + print(p.name) + print(p.idade) From 40c898a1467034028ea40375e736220db1056de8 Mon Sep 17 00:00:00 2001 From: Everton Reis Date: Tue, 22 Nov 2022 17:55:55 -0400 Subject: [PATCH 3/3] =?UTF-8?q?Implementada=20Dire=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oo/carro.py | 133 ++++++++++++++++++++++++++++++++++ venv/lib64 | 1 + venv/pyvenv.cfg | 2 +- venv/share/man/man1/ipython.1 | 60 +++++++++++++++ 4 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 oo/carro.py create mode 120000 venv/lib64 create mode 100644 venv/share/man/man1/ipython.1 diff --git a/oo/carro.py b/oo/carro.py new file mode 100644 index 000000000..cda2d94df --- /dev/null +++ b/oo/carro.py @@ -0,0 +1,133 @@ +''' +Você deve criar uma classe carro que vai possuir dois atributos compostos por outras duas classes: + +1) Motor +2) Direção + +O motor terá a respponsabilidade de controlar a velocidade +Ele oferece os seguintes atributos: + +1) Atributo de dado velocidade +2) Método acelerar, que deverá incrematar a velocidade de uma unidade +3) Método frear que deverá decrementar a velocidade em duas unidades + +A direção terá a responsabilidade de controlar a direção. ela oferece os seguintes atributos: +1) Valor de direção com valores possíveis: Norte, Sul, Leste, Oeste. +2) Método girar_a_direita +3) Método girar_a_esquerda + N +O L + S + + Exemplos: + #testando motor + + >>> motor = Motor() + >>> motor.velocidade + 0 + >>> motor.acelerar() + >>> motor.velocidade + 1 + >>> motor.acelerar() + >>> motor.velocidade + 2 + >>> motor.acelerar() + >>> motor.velocidade + 3 + >>> motor.frear() + >>> motor.velocidade + 1 + >>> motor.frear() + >>> motor.velocidade + 0 + + >>> # Testando Direção + >>> direcao = Direcao() + >>> direcao.girar_a_direita() + >>> direcao.valor + 'Norte' + >>> direcao.girar_a_direita() + >>> direcao.valor + 'Leste' + >>> direcao.girar_a_direita() + >>> direcao.valor + 'Sul' + >>> direcao.girar_a_direita() + >>> direcao.valor + 'Oeste' + >>> direcao.girar_a_direita() + >>> direcao.valor + 'Norte' + >>> direcao.girar_a_esquerda() + >>> direcao.valor + 'Oeste' + >>> direcao.girar_a_esquerda() + >>> direcao.valor + 'Sul' + >>> direcao.girar_a_esquerda() + >>> direcao.valor + 'Leste' + >>> direcao.girar_a_esquerda() + >>> direcao.valor + 'Norte' + + >>> carro = Carro.(direcao,motor) + >>> carro.calcular_velocidade() + 0 + >>> carro.acelerar() + >>> carro.calcular_velocidade() + 1 + >>> carro.acelerar() + >>> carro.calcular_velocidade() + 2 + >>> carro.frear() + >>> carro.calcular_velocidade() + 0 + >>> carro.calcular_direcao() + >>> 'Norte' + >>> carro.girar_a_direita() + >>> carro.calcular_direcao() + >>> 'Leste' + >>> carro.girar_a_direita() + >>> carro.calcular_direcao() + >>> 'Norte' + >>> carro.girar_a_esquerda() + >>> carro.calcular_direcao() + >>> 'Oeste' +''' + +NORTE = 'Norte' +SUL = 'Sul' +LESTE = 'Leste' +OESTE = 'Oeste' + + +class Direcao: + rotacao_a_direita_dct = { + NORTE: LESTE, LESTE: SUL, SUL: OESTE, OESTE: NORTE + } + rotacao_a_esquerda_dct = { + NORTE: OESTE, LESTE: NORTE, SUL: LESTE, OESTE: SUL + + } + + def __init__(self): + self.valor = NORTE + + def girar_a_direita(self): + self.valor = self.rotacao_a_direita_dct[self.valor] + + def girar_a_esquerda(self): + self.valor = self.rotacao_a_esquerda_dct[self.valor] + + +class Motor: + def __init__(self): + self.velocidade = 0 + + def acelerar(self): + self.velocidade += 1 + + def frear(self): + self.velocidade -= 2 + self.velocidade = max(0, self.velocidade) diff --git a/venv/lib64 b/venv/lib64 new file mode 120000 index 000000000..7951405f8 --- /dev/null +++ b/venv/lib64 @@ -0,0 +1 @@ +lib \ No newline at end of file diff --git a/venv/pyvenv.cfg b/venv/pyvenv.cfg index 10427d270..4118bb9c9 100644 --- a/venv/pyvenv.cfg +++ b/venv/pyvenv.cfg @@ -1,3 +1,3 @@ -home = /Library/Developer/CommandLineTools/usr/bin +home = /usr/bin include-system-site-packages = false version = 3.8.2 diff --git a/venv/share/man/man1/ipython.1 b/venv/share/man/man1/ipython.1 new file mode 100644 index 000000000..0f4a191f3 --- /dev/null +++ b/venv/share/man/man1/ipython.1 @@ -0,0 +1,60 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH IPYTHON 1 "July 15, 2011" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) and groff_man(7) +.\" .SH section heading +.\" .SS secondary section heading +.\" +.\" +.\" To preview this page as plain text: nroff -man ipython.1 +.\" +.SH NAME +ipython \- Tools for Interactive Computing in Python. +.SH SYNOPSIS +.B ipython +.RI [ options ] " files" ... + +.B ipython subcommand +.RI [ options ] ... + +.SH DESCRIPTION +An interactive Python shell with automatic history (input and output), dynamic +object introspection, easier configuration, command completion, access to the +system shell, integration with numerical and scientific computing tools, +web notebook, Qt console, and more. + +For more information on how to use IPython, see 'ipython \-\-help', +or 'ipython \-\-help\-all' for all available command\(hyline options. + +.SH "ENVIRONMENT VARIABLES" +.sp +.PP +\fIIPYTHONDIR\fR +.RS 4 +This is the location where IPython stores all its configuration files. The default +is $HOME/.ipython if IPYTHONDIR is not defined. + +You can see the computed value of IPYTHONDIR with `ipython locate`. + +.SH FILES + +IPython uses various configuration files stored in profiles within IPYTHONDIR. +To generate the default configuration files and start configuring IPython, +do 'ipython profile create', and edit '*_config.py' files located in +IPYTHONDIR/profile_default. + +.SH AUTHORS +IPython is written by the IPython Development Team .