Please help me to make it more effective
effective (adjective) = successful in producing a desired or intended result. What is the desired result that your program cannot fulfill completely? Your question is too vague to answer. In terms of code readability, you could improve it a lot, by applying the guidelines in PEP8. https://www.python.org/dev/peps/pep-0008/ But that has nothing to do with effectiveness.
Tibor Santa i think (s)he meant to optimize the code