Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
indexerror and optimization
#3
(Jan-19-2018, 03:40 PM)sparkz_alot Wrote: Please post the error code, in it's entirety, between the error tags. This helps in determining where the problem lies.

Error:
123 3 41 Traceback (most recent call last): File "/home/atharva/PycharmProjects/untitled/ad.py", line 17, in <module> if(x%k[p]==0): IndexError: list index out of range
This was the error, but I sorted it by using
for p in range (0,len(k)):
at line 16.
The optimisation problem still persists.
If I enter something like 12212, I get an answer. But something like 600851475143 just takes too long(still running) that number is the problem input. Thanks for the reply.
Reply


Messages In This Thread
indexerror and optimization - by mcrazy1111 - Jan-19-2018, 03:35 PM
RE: indexerror and optimization - by sparkz_alot - Jan-19-2018, 03:40 PM
RE: indexerror and optimization - by mcrazy1111 - Jan-19-2018, 04:05 PM
RE: indexerror and optimization - by wavic - Jan-19-2018, 04:43 PM
RE: indexerror and optimization - by Mekire - Jan-19-2018, 10:21 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020