DEV Community

Cover image for Ibuprofeno.py💊| #190: Explica este código Python
Cristian Fernando
Cristian Fernando

Posted on

Ibuprofeno.py💊| #190: Explica este código Python

Explica este código Python

Dificultad: Fácil

x = lambda x: len(x.split())
print(type(x))
Enter fullscreen mode Exit fullscreen mode
  • A. class <'function'>
  • B. class <'lambda'>
  • C. class <'tuple'>
  • D. Error

Respuesta:

👉 A. class <'function'>

Las funciones lambda de Python tienen una sintaxis mas compacta y sencilla de comprender, al ser anónimas es usual almacenar su valor de retorno en una variable, dicha variable será de tipo función y para llamar a la función podríamos hacer:

x = lambda x: len(x.split())
print(x("hola como estas"))
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more