I have a list:
a = [1, 2, 3, 4, 5, 6, 7, 8, 9 10, 11, 12]
There are multiple if usages that check a number is in the a list. Whole code is also in a loop.
If 3 in a:
some_work1
If 4 in a:
some_work2
If 8 in a:
some_work3
If 11 in a:
some_work4
Are there faster any (less cpu usage) methods for these multiple if usages? (List a is always same).
Python 3.8.7
Aucun commentaire:
Enregistrer un commentaire