CommencerCommencer gratuitement

Catching salmon example

Every fall the salmon run occurs -- this is the time when salmon swim back upriver from the ocean to spawn. While swimming back to the upper river (usually to the place where they were spawned), the fish may encounter grizzly bears. Some of these bears can eat 18 salmon in 3 hours, and they have a 0.0333 probability of success in their attempts to catch a fish.

Grizzly bears catching salmons

We can model a grizzly bear catching salmon with a geometric distribution.

For the following exercises, the geom object from scipy.stats has already been loaded for your convenience.

Cet exercice fait partie du cours

Foundations of Probability in Python

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Getting a salmon on the third attempt
probability = geom.____(k=____, p=____)

# Print the result
print(probability)
Modifier et exécuter le code