Skip to content

Instantly share code, notes, and snippets.

@ricardosiri68
Last active December 29, 2015 09:09
Show Gist options
  • Save ricardosiri68/7648225 to your computer and use it in GitHub Desktop.
Save ricardosiri68/7648225 to your computer and use it in GitHub Desktop.
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