Answer:
When the sun shines on earth, the sunlight warms up the earth, in the way that sunlight would warm up a greenhouse. At night, when there is no sunlight, the earth cools down, just like a greenhouse. When cooling down, the earth keeps some of the warmth trapped in the atmosphere- just like how a greenhouse would.