Download python/pattern_matching.py from neopilot/PyRs2: direct link, hf CLI and curl.
- Browser
- Download file 250 Bytes
-
https://huggingface.co/datasets/neopilot/PyRs2/resolve/main/python/pattern_matching.py
- Command line
-
hf download hf://datasets/neopilot/PyRs2/python/pattern_matching.py
-
curl -L -o pattern_matching.py https://huggingface.co/datasets/neopilot/PyRs2/resolve/main/python/pattern_matching.py
250 Bytes
| def describe(x): | |
| if x == 1: | |
| print("one") | |
| elif x == 2: | |
| print("two") | |
| elif isinstance(x, str): | |
| print("a string") | |
| else: | |
| print("something else") | |
| describe(1) | |
| describe(2) | |
| describe("hello") | |
| describe([1, 2, 3]) |