Python Forum
count occurrence of numbers in a sequence and return corresponding value
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
count occurrence of numbers in a sequence and return corresponding value
#6
Now I'm even more confused to be honest.

So
X = [5,5,5,5,5]
results in:
Y = [1,1,1,1,1]

but
X = [4,4,4,4,4]
results in
Y = [3,3,3,3,3]

Another thing that is confusing me is that:
X = [1,2,3]
results in
Y = [1,2,3]

but
X = [6,6,6]
results in
Y = [4,6,7]

And in the first example it used to be:
X = [3,4,5]
resulting in
Y = [0,0,0]


What's the logic behind it?
Reply


Messages In This Thread
RE: count occurrence of numbers in a sequence and return corresponding value - by michalmonday - May-20-2019, 05:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I calculate a ratio from 2 numbers and return an equivalent list of about 1000 Pleiades 8 15,892 Jan-05-2024, 08:30 PM
Last Post: sgrey
  Row Count and coloumn count Yegor123 4 1,409 Oct-18-2022, 03:52 AM
Last Post: Yegor123
  How to get unique entries in a list and the count of occurrence james2009 5 3,069 May-08-2022, 04:34 AM
Last Post: ndc85430
  Selecting the first occurrence of a duplicate knight2000 8 5,337 May-25-2021, 01:37 AM
Last Post: knight2000
  How can I found how many numbers are there in a Collatz Sequence that I found? cananb 2 2,595 Nov-23-2020, 05:15 PM
Last Post: cananb
  Checking for one or more occurrence in a list menator01 3 2,755 May-18-2020, 06:44 AM
Last Post: DPaul
  Return prime numbers from range krzyfigh 2 1,980 Apr-20-2020, 08:08 PM
Last Post: krzyfigh
  Define a range, return all numbers of range that are NOT in csv data KiNeMs 18 7,267 Jan-24-2020, 06:19 AM
Last Post: KiNeMs
  How to count and order numbers in a list rachyioli 2 2,613 Aug-21-2019, 10:51 AM
Last Post: perfringo
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 3,821 May-09-2019, 12:19 PM
Last Post: Pleiades

Forum Jump:

User Panel Messages

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