How to prevent our code from exceeding time limit in python 3.6?

Also 1 more question:
I have only given 15 points out of 100 in contest. Why is it so?

In a contest, test cases are grouped into subtasks. If you pass all test cases in the subtask, you will get some partial points corresponding to the sub task you cleared.

If you think your logic is correct and your algorithm is optimized enough, and still you are getting TLE, then try submitting in PyPy language. For Python2 use PyPy2 and for Python3 use PyPy3.
As we know, Python is a slow language, so in many cases, a code with same time complexity passes in C++ but gives TLE in Python. In this case PyPy seems a good alternative. PyPy is just a faster version of Python. You can submit exactly same code.

It doesn’t worked.
It is again exceeding time limit.

This means your code is not optimized enough. You must think and come up with a solution with less time complexity.