Programming in Python time limit exceeded?

Hi, I am new here and wrote a program for Prime Palindromes [PRPALIN] in Python 2.7.2. The program runs fine in the interpreter but it exceeds the time limit of 1 second. I feel that Python is more about precision than speed, so I don’t think any optimisations can improve the time much. So my question is how do I get my program accepted as a right answer? Are there other with similar issues. In the second case, I just got a list (it could have been a tuple of course) of prime palindromes from my earlier program and pasted it into my new program, so that it would run faster by getting rid of the calculations, and even that got rejected. A little wierd, right? Could someone help me with this? Thank you. Links to my programs can be found here:
CodeChef: Practical coding for everyone (the earlier one)
CodeChef: Practical coding for everyone (the newer one)

The last prime palindrome in the list must be 1003001 ,but your list end with 98689…thats the reason for wrong ans in 2nd code…here is your corrected code:CodeChef: Practical coding for everyone

Thanks, but I figured it out myself

1 Like