if s in ('a', 'b'):
return 1
elif s in ('c', 'd'):
return 2
else:
return 3
More Related Contents:
- What is wrong with my python code? [duplicate]
- Transpose/Unzip Function (inverse of zip)?
- Random string generation with upper case letters and digits
- generating variable names on fly in python [duplicate]
- I’m getting Key error in python
- Python: Bind an Unbound Method?
- Proxy with urllib2
- How does numpy.newaxis work and when to use it?
- How do I print colored text to the terminal?
- Relative imports in Python 3
- Windows cmd encoding change causes Python crash
- Python Pandas: Check if string in one column is contained in string of another column in the same row
- Django upgrading to 1.9 error “AppRegistryNotReady: Apps aren’t loaded yet.”
- How To Get All The Contiguous Substrings Of A String In Python?
- Image.open() cannot identify image file – Python?
- Explode in PySpark
- Subclass in type hinting
- Plot bar graph from Pandas DataFrame
- Can’t install psycopg2 package through pip install on MacOS
- How to pass a variable to magic ´run´ function in IPython
- Django REST Framework serializer field required=false
- What is the best way for checking if the user of a script has root-like privileges?
- Save and load model optimizer state
- Unable to get a window, abort
- JSON object must be str, bytes or bytearray, not dict
- Replace QWidget objects at runtime
- Plotly/Dash display real time data in smooth animation
- double quoted elements in csv cant read with pandas
- argparse subcommands with nested namespaces
- Lexical cast from string to type