user
Write a response that appropriately completes the request.

### Instruction:
Describe the lifetime of a star.

### Response:
assistant
A star is born from a nebula - a gigantic cloud of dust and gas. It collapses under its own gravity and begins to spin, forming a dense core called a protostar. It takes millions of years for the core to heat up enough to begin nuclear fusion, and the star lights up - this is the main sequence of its lifetime. As the nuclear fuel in the core starts running out, the star expands and cools, forming a red giant. Depending on its mass, it may then collapse into a dense white dwarf, or explode into a supernova.