teslariu

sumar

Aug 6th, 2022 (edited)
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4.  
  5. def ingresar_numero():
  6. while True:
  7. try:
  8. n = float(input("Ingrese un numero: "))
  9. except ValueError:
  10. print("Debe ingresar un nro")
  11. else:
  12. return n
  13.  
  14.  
  15. def sumar(a,b):
  16. return a+b
  17.  
  18. def multiplicar(a,b):
  19. return a*b
  20.  
  21. if __name__ == '__main__':
  22. print(f"2 + 3 = {sumar(2,3)}")
  23. print(f"2 x 3 = {multiplicar(2,3)}")
Advertisement
Add Comment
Please, Sign In to add comment