Advertisement
Fhernd

generar-funciones-especializadas.py

Feb 2nd, 2018
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. def generar_escala(numero):
  2.     return lambda multiplicador: multiplicador * numero
  3.    
  4. multiplicar_por_2 = generar_escala(2)
  5.  
  6. print(multiplicar_por_2(5))
  7.  
  8. multiplicar_por_3 = generar_escala(3)
  9.  
  10. print(multiplicar_por_3(5))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement