How python simplifies if statements
This article mainly shows you "python how to simplify if sentences", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "python how to simplify if sentences" this article.
Simplify if statement
To validate multiple values, we can do this in the following ways.
If m in [1,3,5,7]:
Instead of:
If masks 1 or masks 3 or masks 5 or masks 7:
Alternatively, we can use'{1rect 3pm 5je 7} 'instead of [1rect 3pm 5je 7] as the' in' operator, because 'set' can access each element through O (1).
These are all the contents of the article "how python simplifies if sentences". 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!