From 276c8de2df667a1c69b013699e4dcd89404a216e Mon Sep 17 00:00:00 2001 From: joaopbs Date: Mon, 6 Apr 2020 11:24:59 -0300 Subject: [PATCH 1/4] criada a classe pessoa --- OO/__init__.py | 0 OO/pessoa.py | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 OO/__init__.py create mode 100644 OO/pessoa.py 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..e1da50e22 --- /dev/null +++ b/OO/pessoa.py @@ -0,0 +1,2 @@ +class Pessoa: + pass \ No newline at end of file From 48a39771e7ab14b63a80d321011c90ddfcfb5a63 Mon Sep 17 00:00:00 2001 From: joaopbs Date: Mon, 6 Apr 2020 12:07:58 -0300 Subject: [PATCH 2/4] =?UTF-8?q?criado=20o=20m=C3=A9todo=20cumprimentar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OO/pessoa.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OO/pessoa.py b/OO/pessoa.py index e1da50e22..28bc38c25 100644 --- a/OO/pessoa.py +++ b/OO/pessoa.py @@ -1,2 +1,8 @@ class Pessoa: - pass \ No newline at end of file + def cumprimentar (self): + return 'Olá' + + if __name__ == '__main__': + p = Pessoa() + print(Pessoa.cumprimentar(p)) + print(p.cumprimentar()) \ No newline at end of file From bbb67e845a3352ac67fb73740ca663b1459affd8 Mon Sep 17 00:00:00 2001 From: joaopbs Date: Mon, 6 Apr 2020 16:16:50 -0300 Subject: [PATCH 3/4] =?UTF-8?q?criado=20o=20m=C3=A9todo=20cumprimentar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OO/pessoa.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/OO/pessoa.py b/OO/pessoa.py index 28bc38c25..6c98d81c9 100644 --- a/OO/pessoa.py +++ b/OO/pessoa.py @@ -1,8 +1,11 @@ + + class Pessoa: def cumprimentar (self): - return 'Olá' + return 'Olá' - if __name__ == '__main__': - p = Pessoa() - print(Pessoa.cumprimentar(p)) - print(p.cumprimentar()) \ No newline at end of file +if __name__ == '__main__': + p = Pessoa() + print(Pessoa.cumprimentar(p)) + print((p)) + print(p.cumprimentar()) \ No newline at end of file From 17b31a29c307eec1aeb63e2888502ebaf5b7961b Mon Sep 17 00:00:00 2001 From: joaopbs Date: Mon, 6 Apr 2020 16:38:11 -0300 Subject: [PATCH 4/4] criado o atributos de dados(idade,nome) --- OO/pessoa.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OO/pessoa.py b/OO/pessoa.py index 6c98d81c9..e73285506 100644 --- a/OO/pessoa.py +++ b/OO/pessoa.py @@ -1,6 +1,10 @@ class Pessoa: + def __init__(self,nome=None,idade=35): + self.idade = idade + self.nome = None + def cumprimentar (self): return 'Olá' @@ -8,4 +12,7 @@ def cumprimentar (self): p = Pessoa() print(Pessoa.cumprimentar(p)) print((p)) - print(p.cumprimentar()) \ No newline at end of file + print(p.cumprimentar()) + print(p.nome) + p.nome = 'João' + print(p.nome) \ No newline at end of file