Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A big for in for Loop!
#6
(Sep-03-2020, 06:30 AM)bowlofred Wrote: 10000 isn't a large number for modern machines. Use a counter to count all the points. Then print all the points that have a count greater than 1.

from collections import Counter
all_points = Counter(zip(x,y,z,p))
duplicate_points = [i for i in all_points if all_points[i] > 1]

Thank you. It seems to be much better.
I also modified my for loops, because i had some IF conditions inside the for loop.
by putting them out the problem solved.
Thanks again for your help!
Reply


Messages In This Thread
A big for in for Loop! - by faryad13 - Sep-03-2020, 05:58 AM
RE: A big for in for Loop! - by buran - Sep-03-2020, 06:10 AM
RE: A big for in for Loop! - by faryad13 - Sep-03-2020, 06:13 AM
RE: A big for in for Loop! - by buran - Sep-03-2020, 06:20 AM
RE: A big for in for Loop! - by bowlofred - Sep-03-2020, 06:30 AM
RE: A big for in for Loop! - by faryad13 - Sep-03-2020, 08:09 AM

Forum Jump:

User Panel Messages

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