Skip to navigation
if..elif..else block in one-line using python
07.09.21
expr1 if condition1 else expr2 if condition2 else expr example: data['all_stock'] = 'all' if min(data['stock']) > 0 else 'some' if max(data['stock']) > 0 else 'none'
https://www.golinuxcloud.com/python-if-else-one-line/
Reply
Anonymous
Information Epoch 1732535062
Clarity is better than cleverness.
Home
Notebook
Contact us