Skip to content

Instantly share code, notes, and snippets.

@mobileappconsultant
Last active December 5, 2018 12:34
Show Gist options
  • Save mobileappconsultant/02af47d13392a0ffbfffdf66e585321b to your computer and use it in GitHub Desktop.
Save mobileappconsultant/02af47d13392a0ffbfffdf66e585321b to your computer and use it in GitHub Desktop.
List all the commands or reserved keywords in python. Practice lambda syntax
import keyword
print(keyword.kwlist)
print("There are {} commands in Python".format(len(keyword.kwlist)))
# a is a lambda that takes an input x and performs an operation : x**2
# a is variable name assigned to lamda(python keyword) that takes an input x and(:) ..whatever comes after : is the operation
a = lambda x:x**2
y = lambda x:x**5
print(a(5))
print(y(9))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment