
A promise between a bird and the clouds.
The Dry Season
A long time ago, before the monsoon had a schedule, rain came whenever it pleased — sometimes three times a day, sometimes not for months. The animals and plants never knew when to expect it, and this made life very difficult.
The farmers couldn't plan their planting. The rivers didn't know when to fill. And the peacock — the most beautiful bird in the forest — was miserable, because his magnificent tail feathers drooped and dulled without rain to wash them.
"I look terrible," said the peacock, staring at his reflection in a dusty puddle. His blues were grey. His greens were brown. His eye-spots looked like smudges.
The Cloud's Problem
High above, the monsoon cloud had her own problem. She was new to the job — the old monsoon cloud had retired — and she didn't know the way to the land below. She drifted aimlessly over the ocean, full of rain with nowhere to drop it.
"I have all this water," she muttered, "but I can't find the fields. Everything looks the same from up here — blue ocean, blue ocean, more blue ocean. How will I know when I've reached the land?"
The Bargain
The peacock heard the cloud's muttering — sound travels strangely between earth and sky — and called up to her.
"Cloud! I can help you find the land!"
"How?" asked the cloud.
"When you get close, I will dance. My tail has a hundred eyes — green and blue and gold. You can see them from anywhere. Follow the eyes, and you'll find the fields."
"And what do you want in return?"
"Rain," said the peacock. "Regular, reliable rain, so my feathers stay bright and the farmers can plan their crops."
The cloud thought about it. "Deal," she said. "Dance for me, and I will rain for you. Every year, same time, same place."
The First Dance
When the monsoon cloud drifted close to the land for the first time, she looked down and saw nothing but a blur of green and brown. She couldn't tell field from forest, river from road.
Then she saw it — a burst of colour on a hilltop. A hundred eyes, shimmering blue and green and gold, spread wide like a living fan. The peacock was dancing. His feet stamped the earth. His tail quivered and shook. His neck arched and his beak pointed to the sky as if to say: "Here! Drop it here!"
The cloud followed the eyes and released her rain — a glorious, drenching, life-giving downpour that turned the brown earth green in a single afternoon.
The Promise Kept
From that year on, the peacock danced every time he felt the monsoon approaching. He could sense the change in the air — the humidity, the drop in pressure, the smell of rain still miles away. And when he danced, the cloud knew where to go.
The farmers noticed. "When the peacock dances, rain is coming," they said. And they were always right.
To this very day, in the forests and fields of Assam and all across India, the peacock dances before the rain. Not because he's happy — though he is. Not because he's showing off — though he is that too. But because he made a promise to a cloud, long ago, and the peacock is a bird who always keeps his word.
The end.
Choose your level. Everyone starts with the story — the code gets deeper as you go.
Here is a taste of what Level 1 looks like for this lesson:
import matplotlib.pyplot as plt
import numpy as np
# Peacock tail eyespot count vs mating success
eyespots = [120, 130, 140, 150, 155, 160, 165, 170]
matings = [0.5, 1.0, 1.8, 2.5, 3.1, 3.6, 4.0, 4.2]
plt.figure(figsize=(8, 5))
plt.scatter(eyespots, matings, color="purple", s=80)
plt.xlabel("Number of Eyespots in Tail Fan")
plt.ylabel("Average Matings per Season")
plt.title("Do More Eyespots = More Mates?")
plt.plot(eyespots, matings, "--", alpha=0.4, color="purple")
plt.show() # What shape is this relationship?This is just the first of 6 coding exercises in Level 1. By Level 4, you will build: Correlate Animal Behavior with Weather Data.
By Level 4, enrolled students build: Correlate Animal Behavior with Weather Data
Free
Level 0: Listener
Stories, science concepts, diagrams, quizzes. No coding.
You are here
Level 0 is always free. Coding levels (1-4) are part of our 12-Month Curriculum.
A promise between a bird and the clouds.
The big idea: "Why Peacocks Dance Before Rain" teaches us about Animal Communication & Signaling — and you don't need to write a single line of code to understand it.
Charles Darwin was troubled by the peacock's tail. His theory of natural selection predicted that organisms should become better adapted to survive, but the peacock's enormous, heavy, conspicuous tail seemed to do the opposite — it makes the bird slower, more visible to predators, and wastes enormous metabolic energy to grow each year. "The sight of a feather in a peacock's tail, whenever I gaze at it, makes me sick," Darwin wrote in 1860.
His solution was a second evolutionary mechanism: sexual selection. While natural selection favors traits that help an organism survive, sexual selection favors traits that help an organism reproduce — even if those traits are costly to survival. If peahens consistently prefer males with larger, more colorful tails, then those males will father more offspring, passing on the genes for elaborate tails. Over many generations, the tail becomes increasingly extravagant because each generation of females selects for it.
The Israeli biologist Amotz Zahavi proposed the "handicap principle" to explain why this works. The peacock's tail is an honest signal of genetic quality precisely because it is costly. Only a truly healthy, well-fed, genetically superior male can survive despite carrying such a burden. The tail says, in effect, "I am so strong and fit that I can afford this ridiculous handicap and still outrun predators." A weak or diseased male simply cannot fake this signal.
Key idea: Sexual selection drives the evolution of costly ornaments like the peacock's tail because they honestly advertise genetic quality to potential mates.
Peacock feathers contain no blue or green pigment. The stunning colors come entirely from the physical structure of the feather — a phenomenon called structural coloration. Each barbule (the tiny branch of a feather barb) contains a lattice of melanin rods arranged in layers, separated by thin films of keratin and air. When white light hits these layers, something remarkable happens: thin-film interference.
Thin-film interference occurs when light waves reflect off the top and bottom surfaces of a thin transparent layer. The two reflected waves travel slightly different distances, and when they recombine, they can either reinforce each other (constructive interference, producing bright color) or cancel each other out (destructive interference, producing no color). Which wavelength gets reinforced depends on the thickness of the film and the viewing angle.
This is why peacock feathers are iridescent — the color changes as you tilt the feather. At one angle, the film thickness produces constructive interference for blue light (wavelength ~470 nm). Tilt slightly, and the effective path length changes, shifting the constructive interference to green (~520 nm) or even yellow. The same physics creates the rainbow sheen on soap bubbles, oil slicks on water, and the anti-reflective coatings on camera lenses. Engineers study peacock feathers to design better optical coatings, color-shifting inks for currency security, and structural color for textiles that never fade.
Key idea: Peacock feather colors come from thin-film interference in nanostructured melanin layers, not from pigments — the same physics as soap bubble rainbows.
Access all 130+ lessons, quizzes, interactive tools, and offline activities
Peahens do not choose mates randomly. Research by Marion Petrie at the University of Newcastle showed that peahens consistently prefer males with more...