A list gives six days of light and dark. Each has a kind of plant, the hours of light, and whether a flash breaks the night. You will work out the dark periods, write a function that tells whether a plant flowers, and count the flowering cases.
The idea. A plant measures its unbroken dark period. A short-day plant flowers when the dark is at least the critical dark period and is not broken. A long-day plant flowers when the dark is shorter than that, or is broken by a flash.
Your tasks.
dark_periods to the dark period of each day, in the order of the list.flowers. It tells whether a plant of this kind flowers.count to the number of days in the list that make the plant flower.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…