Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Intersection
#4
So, let's assume the input is as follows:
2
4
1 3 6 9
4
1 2 7 9

I made the change so that you see the full picture

channel1 is busy at 1,2,3,6,7,8,9 and channel2 is busy at 1, 2,7,8,9

what I suggest:
channels_busy = sorted(list(set([1,2,3,6,7,8,9]).intersection(set([1,2,7,8,9]))))
print(channels_busy)
the output will be [1, 2, 7, 8, 9] and you only have to transform it to [1, 2, 7, 9]
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
Intersection - by Kimberley100 - Oct-10-2020, 09:39 AM
RE: Intersection - by buran - Oct-10-2020, 09:48 AM
RE: Intersection - by Kimberley100 - Oct-10-2020, 02:56 PM
RE: Intersection - by buran - Oct-10-2020, 03:12 PM
RE: Intersection - by Kimberley100 - Oct-10-2020, 08:07 PM
RE: Intersection - by buran - Oct-10-2020, 08:21 PM
RE: Intersection - by Kimberley100 - Oct-10-2020, 08:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Intersection of a triangle and a circle Gira 3 3,764 May-19-2019, 06:04 PM
Last Post: heiner55

Forum Jump:

User Panel Messages

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