Source Code:
(back to article)
def f(x): def g(): return "Function g" def h(): return "Function h" def i(): return "Function i" switch = { 1: g, 2: h, 3: i } return switch.get(x, lambda: "Something else")() print(f(3))
Result:
Report an issue