A flower has four main parts:
Some species of plants produce separate male flowers (containing the stamens) and female flowers (containing the pistil). In some of these species, an individual plant is either male or female; in others, male and female flowers appear on the same plant. In other species, individual flowers have both pistils and stamens. Some of these flowers are capable of self-fertilization, which increases the chance of producing seeds, but limits genetic variation. The extreme case of this is flowers that always self-fertilize, such as the common dandelion. Conversely, some species of plants have ways of preventing self-fertilization. Male and female flowers on the same plant may not appear at the same time, or pollen from the same plant may be incapable of fertilizing its ovules.
A major function of flowers is to attract animals to pollinate the plant. Bees and birds are among the common pollinators: both have color vision, thus selecting for colorful flowers. (Some white flowers have patterns in the ultraviolet, which are visible to bees but not to humans.) Flowers also attract pollinators by scent. In either case, the pollinators come to the plant in search of nectar, which they eat: in gathering nectar from many flowers of the same species, the pollinators transfer pollen between the flowers. Flower scent is not always pleasant to the nose: some plants (such as Rafflesia and the titan arum) are pollinated mainly by flies, so produce a scent imitating rotten meat.
The great variety of delicate and beautiful flowers has inspired the works of poets. This is a short fragment called "Ah! Sun-Flower" from William Blake: