GoConqr has a new look! Let us know what you think.

Notes

Classe e Função

Cleison Silva Portuguese 1 page

Content of the notes (1)

Page 1

#exemplo classe e funções

class Calculadora:

def __init__(self, num1, num2):

self.valor_a = num1

self.valor_b = num2

def soma(self):

return self.valor_a + self.valor_b

def subtração(self):

return self.valor_a - self.valor_b

def multiplicacao(self):

return self.valor_a * self.valor_b

def divisao(self):

return self.valor_a / self.valor_b

calculadora = Calculadora(10, 2)

print(calculadora.valor_a)

print(calculadora.valor_b)

print(calculadora.soma())

print(calculadora.subtração())

print(calculadora.multiplicacao())

print(calculadora.divisao())

Information

Description
Note on Classe e Função, created by Cleison Silva on 26/10/2021.
Created by
Cleison Silva
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?