-1

I have a set that contains all the possible values present in a list. What I want is to know how much of each value are present in the list.

So, I have:

set_a = ("a","b", "c", "d")
lst = ["a", "b", "c", "c"]

What I want is this:

a 1
b 1
c 2
Cœur
  • 37,241
  • 25
  • 195
  • 267
oaklander114
  • 3,143
  • 3
  • 16
  • 24

1 Answers1

0

You will see solutions here: How can I count the occurrences of a list item in Python?

For instance you can do:

[1, 2, 3, 4, 1, 4, 1].count(1)
Community
  • 1
  • 1
PatriceG
  • 3,851
  • 5
  • 28
  • 43