Get the App
SLTechnology News&Howtos  ›  Development  › 

How python uses dictionaries instead of multiple if else

Shulou Source: shulou.com Published: 2022-06-01 04:51:03 09月30日 Update

I would like to share with you how python uses dictionaries instead of multiple if else. I believe most people don't know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's learn about it together.

Dictionaries replace multiple if else

Def fun (x): if x = ='a dictionary: return 1 elif x = 'baked: return 2 else: return Nonedef fun (x): return {"a": 1, "b": 2}. Get (x) these are all the contents of the article "how python uses dictionaries instead of multiple if else". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Multiple dictionaries articles content not much most more knowledge industry information channels channels references learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno Linux Microsoft Shulou Tech Info