Python Forum
Quick Lists Question (Count Occurences)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Quick Lists Question (Count Occurences)
#9
This works also:

from collections import Counter
my_numbers = input('Enter 9 numbers separated by spaces: ')
lst = my_numbers.split(' ')
if len(lst) != 9:
    print("error: less or more than 9 numbers")

print(Counter(lst))
Reply


Messages In This Thread
Quick Lists Question (Count Occurences) - by EwH006 - Nov-16-2016, 12:06 AM
RE: Quick Lists Question (Count Occurences) - by heiner55 - Nov-16-2016, 05:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Count occurences in a string and add to a list using loops Leyo 4 1,706 Mar-11-2022, 03:52 PM
Last Post: Leyo
  Calculator I need quick help Malin3k 3 2,087 Feb-13-2021, 02:10 AM
Last Post: BashBedlam
  Count Letters in a Sentence (without using the Count Function) bhill 3 5,217 Jun-19-2018, 02:52 AM
Last Post: bhill
  regex, counting occurences yanhto 4 3,402 May-06-2018, 10:20 PM
Last Post: killerrex

Forum Jump:

User Panel Messages

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