Last active
December 5, 2018 12:34
-
-
Save mobileappconsultant/02af47d13392a0ffbfffdf66e585321b to your computer and use it in GitHub Desktop.
List all the commands or reserved keywords in python. Practice lambda syntax
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
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