Skip to content

Instantly share code, notes, and snippets.

@NirantK
Last active July 4, 2023 10:54
Show Gist options
  • Save NirantK/c770b55f0f0a6941a58ed751b86f535e to your computer and use it in GitHub Desktop.
Save NirantK/c770b55f0f0a6941a58ed751b86f535e to your computer and use it in GitHub Desktop.
lambda functions in f strings
# 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