SyntaxFix
Write A Post
Hire A Developer
Questions
you can use enumerate keeping the ind/index of the elements is in vm, if you make vm a set you will also have 0(1) lookups:
vm
0(1)
vm = {-1, -1, -1, -1} print([ind if q in vm else 9999 for ind,ele in enumerate(vm) ])