106-7 Why do we use the get method to add values to a dictionnary?

Screen Link: 106-7

Hi everyone,

During this mission, we are being asked to check if a key exists in a dictionary.
If it is the case we add +1 to its value, otherwise we create this key and give it a value of 1.

I’ve always done it in this way :

sampling_distribution = {}

for i in mean_differences:
     if i in sampling_distribution:
         sampling_distribution[i] += 1
     else:
         sampling_distribution[i] = 1

In this case, in the course, we are being asked to use the .get method. It seems much longer and complicated, in both cases, we have the same dictionary in the end.

for i in mean_differences:
    if sampling_distribution.get(i, False):
        val = sampling_distribution.get(i)
        inc = val + 1
        sampling_distribution[i] = inc
    else:
        sampling_distribution[i] = 1

Are there some advantages to use the get method? Is it faster to process?
Or is it in order to teach us this method for other purposes, that I will discover later?

Thanks in advance for your answer,

Have a good day!

Félix