Jeśli widzisz tę wiadomość oznacza to, że mamy problemy z załadowaniem zewnętrznych materiałów na naszej stronie internetowej.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Główna zawartość

Iterating over lists with loops

Zadanie

A nutrition scientist is working on code to calculate the most magnesium-rich foods.
Their program processes a list of numbers representing milligrams of magnesium in servings of food. The goal of the program is to create a new list that contains only the numbers that represent at least 30% of the recommended daily intake of 360 milligrams.
mgAmounts ← [50, 230, 63, 98, 80, 120, 71, 158, 41]
bestAmounts ← []
mgPerDay ← 360
mgMin ← mgPerDay * 0.3
FOR EACH mgAmount IN mgAmounts
{
    IF (mgAmount ≥ mgMin)
    {
        <MISSING CODE>
    }
}
A line of code is missing, however.
What can replace <MISSING CODE> so that this program will work as expected?
👁️Note that there may be multiple answers to this question.
Zaznacz wszystkie odpowiedzi, które pasują:
🤔