Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. #Calculadora básica
  2.  
  3. class calculadora(object):
  4.  
  5.     def soma(self, a, b):
  6.         return a + b
  7.  
  8.     def sub(self, a, b):
  9.         return a - b
  10.  
  11.     def div(self, a, b):
  12.         return a / b
  13.  
  14.     def multi(self, a, b):
  15.         return a * b
  16.  
  17. #from nomedoarquivo import nome da classe
  18. from Calculadora import calculadora
  19.  
  20. c = calculadora()
  21. print('Soma: ', c.soma(15,15))
  22. print('Subtração: ', c.sub(100,28))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement