<filename>language-learning/python/pythonic_code/working_with_data/counting_repeated_values.py
fruits = [
    'banana',
    'apple',
    'mango',
    'mango',
    'banana',
    'pineapple'
]

# iterating
fruits_counter = {}

for fruit in fruits:
    if fruit in fruits_counter:
        fruits_counter[fruit] += 1
    else:
        fruits_counter[fruit] = 1

print(fruits_counter)

# using Counter from collections
from collections import Counter
print(Counter(fruits))

<filename>language-learning/python/pythonic_code/working_with_data/counting_repeated_values.py
fruits = [
    'banana',
    'apple',
    'mango',
    'mango',
    'banana',
    'pineapple'
]

# iterating
fruits_counter = {}

for fruit in fruits:
    if fruit in fruits_counter:
        fruits_counter[fruit] += 1
    else:
        fruits_counter[fruit] = 1

print(fruits_counter)

# using Counter from collections
from collections import Counter
print(Counter(fruits))

# iterating # using Counter from collections