Skip to content

Instantly share code, notes, and snippets.

@BurhanH
Created February 26, 2019 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BurhanH/9a2ecf3994b955be8d4094b10f79a66d to your computer and use it in GitHub Desktop.
Save BurhanH/9a2ecf3994b955be8d4094b10f79a66d to your computer and use it in GitHub Desktop.
lambdas
# -*- coding: utf-8 -*-
addition = lambda x, y: x + y
addition(3, 3)
#6
# OR
(lambda x, y: x + y)(3, 3)
#6
sorted(range(-5, 6), key=lambda x: x * x)
#[0, -1, 1, -2, 2, -3, 3, -4, 4, -5, 5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment