DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
switch case dictionary python
result = { 'a': lambda x: x * 5, 'b': lambda x: x + 7, 'c': lambda x: x - 2 }[value](x)
Source by simonwillison.net #
PREVIOUS
NEXT
Tagged:
#switch
#case
#dictionary
#python
ADD COMMENT
Topic
COMMENT
Name
9+5 =
Submit