Last active
July 4, 2023 10:54
-
-
Save NirantK/c770b55f0f0a6941a58ed751b86f535e to your computer and use it in GitHub Desktop.
lambda functions in f strings
This file contains 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
# If you feel you must use lambdas, they may be used inside of parentheses: | |
print(f'{(lambda x: x*3)(3)}') | |
# '9' | |
# not that this returned a <str> and not <int> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment