Last active
December 29, 2015 09:09
-
-
Save ricardosiri68/7648225 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Operaciones: | |
def __init__(self): | |
self.a=float(input("Por favor introduzca el primer numero: " )) | |
self.b=float(input("Por favor introduzca el segundo numero: " )) | |
def suma(self): | |
return self.a + self.b | |
def resta(self): | |
return self.a - self.b | |
class Imprimir: | |
def __init__(self, ops): | |
self.__ops = ops | |
def imprime(self): | |
print "El resultado de la suma es: ", self.__ops.suma() | |
print "El resultado de la resta es: ", self.__ops.resta() | |
raw_input() | |
# Creando objetos y llamando mtodos | |
op=Operaciones() | |
imp=Imprimir(op) | |
imp.imprime() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment